Issue #6179 has been updated by phasis68 (Heesob Park).



I am not sure this issue is same to the following behavior.
But I found a bug of File#pos in trunk version.

C:\work>type foo.txt
1234567890

C:\work>ruby -v
ruby 2.0.0dev (2012-03-20 trunk 35094) [i386-mswin32_100]

C:\work>irb
irb(main):001:0> a = File.open('foo.txt')
=> #<File:foo.txt>
irb(main):002:0> a.pos
=> 0
irb(main):003:0> a.getc
=> "1"
irb(main):004:0> a.pos
=> 2
irb(main):005:0> a.getc
=> "3"
irb(main):006:0> a.pos
=> 4
irb(main):007:0> a.getc
=> "5"
irb(main):008:0> a.pos
=> 6

Whereas ruby 1.9.3p125 works as expected.

C:\work>ruby -v
ruby 1.9.3p125 (2012-02-16) [i386-mingw32]

C:\work>irb
irb(main):001:0> a = File.open('foo.txt')
=> #<File:foo.txt>
irb(main):002:0> a.pos
=> 0
irb(main):003:0> a.getc
=> "1"
irb(main):004:0> a.pos
=> 1
irb(main):005:0> a.getc
=> "2"
irb(main):006:0> a.pos
=> 2
irb(main):007:0> a.getc
=> "3"
irb(main):008:0> a.pos
=> 3

----------------------------------------
Bug #6179: File::pos broken in Windows 1.9.3p125
https://bugs.ruby-lang.org/issues/6179#change-24997

Author: jmthomas (Jason Thomas)
Status: Feedback
Priority: Normal
Assignee: 
Category: core
Target version: 1.9.3
ruby -v: 1.9.3p125


Calling the pos method on a File in the Windows version of Ruby on 1.9.3p125 moves the file pointer. Thus it can not be called without side effect.


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