ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
* [ruby-core:70389] [Ruby trunk - Bug #11445] [Open] Ruby 1.9.3 - StringIO clone method creates new instance but somehow connected with the original instance
       [not found] <redmine.issue-11445.20150814121137@ruby-lang.org>
@ 2015-08-14 12:11 ` mbrunat
  2015-08-14 21:48 ` [ruby-core:70393] [Ruby trunk - Bug #11445] [Rejected] " nobu
  1 sibling, 0 replies; 2+ messages in thread
From: mbrunat @ 2015-08-14 12:11 UTC (permalink / raw
  To: ruby-core

Issue #11445 has been reported by Michal Brunát.

----------------------------------------
Bug #11445: Ruby 1.9.3 - StringIO clone method creates new instance but somehow connected with the original instance
https://bugs.ruby-lang.org/issues/11445

* Author: Michal Brunát
* Status: Open
* Priority: Normal
* Assignee: 
* ruby -v: ruby 1.9.3p551 (2014-11-13 revision 48407) [x86_64-linux]
* Backport: 1.9.3: UNKNOWN
----------------------------------------
In Ruby 1.9.3 cloned StringIO instance has influence on close state of original instance:
require 'stringio'

sio1 = StringIO.new( 'abc' )
sio2 = sio1.clone

sio2.read
sio1.pos  # => 3, expected 0

sio2.close
sio1.closed?  # => true, expected false

If File is used instead of StringIO, close state is not shared between instances (position is).

This behaviour has changed in Ruby 2.0.0 (cloned StringIO instance does not close original instance).

It matters what definition for IO clone is, whether to share attributes (e.g. pos) and/or state (closed?) but the later is acting differently in 1.9.3 for StringIO and File.




-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [ruby-core:70393] [Ruby trunk - Bug #11445] [Rejected] Ruby 1.9.3 - StringIO clone method creates new instance but somehow connected with the original instance
       [not found] <redmine.issue-11445.20150814121137@ruby-lang.org>
  2015-08-14 12:11 ` [ruby-core:70389] [Ruby trunk - Bug #11445] [Open] Ruby 1.9.3 - StringIO clone method creates new instance but somehow connected with the original instance mbrunat
@ 2015-08-14 21:48 ` nobu
  1 sibling, 0 replies; 2+ messages in thread
From: nobu @ 2015-08-14 21:48 UTC (permalink / raw
  To: ruby-core

Issue #11445 has been updated by Nobuyoshi Nakada.

Description updated
Status changed from Open to Rejected

1.9 has finished.

----------------------------------------
Bug #11445: Ruby 1.9.3 - StringIO clone method creates new instance but somehow connected with the original instance
https://bugs.ruby-lang.org/issues/11445#change-53794

* Author: Michal Brunát
* Status: Rejected
* Priority: Normal
* Assignee: 
* ruby -v: ruby 1.9.3p551 (2014-11-13 revision 48407) [x86_64-linux]
* Backport: 1.9.3: UNKNOWN
----------------------------------------
In Ruby 1.9.3 cloned `StringIO` instance has influence on close state of original instance:

~~~ruby
require 'stringio'

sio1 = StringIO.new( 'abc' )
sio2 = sio1.clone

sio2.read
sio1.pos  # => 3, expected 0

sio2.close
sio1.closed?  # => true, expected false
~~~

If `File` is used instead of `StringIO`, close state is not shared between instances (position is).

This behaviour has changed in Ruby 2.0.0 (cloned `StringIO` instance does not close original instance).

It matters what definition for `IO` clone is, whether to share attributes (e.g. `pos`) and/or state (`closed?`) but the later is acting differently in 1.9.3 for `StringIO` and `File`.




-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-08-14 21:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <redmine.issue-11445.20150814121137@ruby-lang.org>
2015-08-14 12:11 ` [ruby-core:70389] [Ruby trunk - Bug #11445] [Open] Ruby 1.9.3 - StringIO clone method creates new instance but somehow connected with the original instance mbrunat
2015-08-14 21:48 ` [ruby-core:70393] [Ruby trunk - Bug #11445] [Rejected] " nobu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).