Project

General

Profile

Bug #11015

IO.copy_stream does not advance Tempfile destination

Added by headius (Charles Nutter) over 4 years ago. Updated over 4 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Target version:
-
ruby -v:
ruby 2.2.0p0 (2014-12-25 revision 49005) [x86_64-darwin14]
[ruby-core:<unknown>]

Description

The following script, reported to JRuby in https://github.com/jruby/jruby/issues/2762, shows that MRI does not advance the position of a Tempfile when using copy_stream:

require "stringio"
require "tempfile"
file = Tempfile.new('foo')
IO.copy_stream(StringIO.new('foo'), file)
file.eof? #=> false (it's on the beginning)

Other types of streams leave the destination where it is after the copy, so I believe this is a bug.


Related issues

Related to Ruby master - Bug #11199: IO.copy_stream degrade that can't call pathname to pathnameClosedActions

Associated revisions

Revision efbfd902
Added by nobu (Nobuyoshi Nakada) over 4 years ago

io.c: use read/write methods if possible

  • io.c (copy_stream_body): use the arguments without conversion if having read, readpartial, and write methods, than conversion by to_path method. [ruby-core:68676] [Bug #11015]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50118 b2dd03c8-39d4-4d8f-98ff-823fe69b080e

Revision 50118
Added by nobu (Nobuyoshi Nakada) over 4 years ago

io.c: use read/write methods if possible

  • io.c (copy_stream_body): use the arguments without conversion if having read, readpartial, and write methods, than conversion by to_path method. [ruby-core:68676] [Bug #11015]

Revision 50118
Added by nobu (Nobuyoshi Nakada) over 4 years ago

io.c: use read/write methods if possible

  • io.c (copy_stream_body): use the arguments without conversion if having read, readpartial, and write methods, than conversion by to_path method. [ruby-core:68676] [Bug #11015]

Revision 50118
Added by nobu (Nobuyoshi Nakada) over 4 years ago

io.c: use read/write methods if possible

  • io.c (copy_stream_body): use the arguments without conversion if having read, readpartial, and write methods, than conversion by to_path method. [ruby-core:68676] [Bug #11015]

Revision 50118
Added by nobu (Nobuyoshi Nakada) over 4 years ago

io.c: use read/write methods if possible

  • io.c (copy_stream_body): use the arguments without conversion if having read, readpartial, and write methods, than conversion by to_path method. [ruby-core:68676] [Bug #11015]

Revision 50118
Added by nobu (Nobuyoshi Nakada) over 4 years ago

io.c: use read/write methods if possible

  • io.c (copy_stream_body): use the arguments without conversion if having read, readpartial, and write methods, than conversion by to_path method. [ruby-core:68676] [Bug #11015]

History

#1

Updated by nobu (Nobuyoshi Nakada) over 4 years ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100

Applied in changeset r50118.


io.c: use read/write methods if possible

  • io.c (copy_stream_body): use the arguments without conversion if having read, readpartial, and write methods, than conversion by to_path method. [ruby-core:68676] [Bug #11015]
#2

Updated by nobu (Nobuyoshi Nakada) over 4 years ago

  • Description updated (diff)
#3

Updated by headius (Charles Nutter) over 4 years ago

Closing the loop on one detail...

This didn't affect JRuby because JRuby's Tempfile actually subclasses IO, rather than wrapping and delegating.

#4

Updated by nobu (Nobuyoshi Nakada) almost 4 years ago

  • Related to Bug #11199: IO.copy_stream degrade that can't call pathname to pathname added

Also available in: Atom PDF