Project

General

Profile

Actions

Bug #2700

closed

various behavior when reopening File twice

Added by mame (Yusuke Endoh) over 14 years ago. Updated about 13 years ago.

Status:
Rejected
Target version:
-
ruby -v:
nil
Backport:
[ruby-dev:40278]

Description

=begin
遠藤です。

下記のように、読みかけの File インスタンスを使って 2 回 reopen した
ときの挙動が、バージョンによってまちまちです。

$ cat foo.txt
1
2
3

$ cat bar.txt
a
b
c

$ cat t.rb
f1 = File.new("foo.txt")
f2 = File.new("bar.txt")
f1.reopen(f2)
f1.gets
f1.gets
p f1.reopen(f2).gets

$ ruby18 -v t.rb
ruby 1.8.8dev (2010-01-27 revision 26440) [i686-linux]
"a\n"

$ ruby-1.9.1-p378 -v t.rb
ruby 1.9.1p378 (2010-01-10 revision 26273) [i686-linux]
nil

$ ./ruby -v t.rb
ruby 1.9.2dev (2010-01-31 trunk 26528) [i686-linux]
"c\n"

どうなるのが正解でしょうか。

--
Yusuke ENDOH
=end


Related issues 1 (0 open1 closed)

Related to Ruby master - Bug #2516: IO#reopen Compatibility (original: [ruby-dev:39479])Rejectednobu (Nobuyoshi Nakada)12/23/2009Actions
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0