Project

General

Profile

Bug #11199

IO.copy_stream degrade that can't call pathname to pathname

Added by ksss (Yuki Kurihara) over 5 years ago. Updated almost 5 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Target version:
-
ruby -v:
ruby 2.3.0dev (2015-05-30 trunk 50686) [x86_64-darwin14]
[ruby-dev:49008]

Description

IO.copy_stream について、2.2.2〜2.3.0dev間で動作に差異がありました。

再現スクリプトを添付します。

#! /usr/bin/env ruby

require 'pathname'

IO.write "src", "ok"
src = Pathname.new("src")
dst = Pathname.new("dst")
IO.copy_stream src, dst
puts IO.read("dst")
$ ruby --version
ruby 2.2.2p95 (2015-04-13 revision 50295) [x86_64-darwin14]
$ ruby copy_stream.rb
ok
$ ruby --version
ruby 2.3.0dev (2015-05-30 trunk 50686) [x86_64-darwin14]
$ ruby copy_stream.rb
copy_stream.rb:8:in `read': no implicit conversion from string (TypeError)
    from copy_stream.rb:8:in `read'
    from copy_stream.rb:8:in `copy_stream'
    from copy_stream.rb:8:in `<main>'

仕様変更でなければ、互換性を壊さないために2.2.2の動作を期待します。


Files

copy_stream.rb (160 Bytes) copy_stream.rb ksss (Yuki Kurihara), 05/30/2015 10:36 AM

Related issues

Related to Ruby master - Bug #11015: IO.copy_stream does not advance Tempfile destinationClosed03/29/2015Actions

Updated by deivid (David Rodríguez) almost 5 years ago

Hi!

We run into this here: https://github.com/janko-m/shrine/commit/399adcecad64c66ca4ffb1b1619777ff8551e761. That test passes in 2.2.3 but fails in 2.3.0.preview1, apparently due to this issue. Is fixing this planned for 2.3.0?

Thanks a lot.

#2

Updated by nobu (Nobuyoshi Nakada) almost 5 years ago

  • Related to Bug #11015: IO.copy_stream does not advance Tempfile destination added
#3

Updated by nobu (Nobuyoshi Nakada) almost 5 years ago

  • Status changed from Open to Closed

Applied in changeset r52750.


io.c: try to_io first

  • io.c (copy_stream_body): try to_io conversion before read, readpartial, and write methods. [ruby-dev:49008] [Bug #11199]

Updated by deivid (David Rodríguez) almost 5 years ago

That was fast, Nobu! Thanks!!

Updated by nagachika (Tomoyuki Chikanaga) almost 5 years ago

  • Backport changed from 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN to 2.0.0: DONTNEED, 2.1: DONTNEED, 2.2: DONTNEED

Updated by ksss (Yuki Kurihara) almost 5 years ago

Thank you all!

Also available in: Atom PDF