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


File.open with "r" means binary mode reading and it fails.

C:\work>irb
irb(main):001:0> File.write("foo", "line one\nline two\nline three\n")
=> 29
irb(main):002:0> f = File.open("foo","r")
=> #<File:foo>
irb(main):003:0> f.readline
=> "line one\n"
irb(main):004:0> f.pos
=> 12
irb(main):005:0> f.readline
=> "ne two\n"
irb(main):006:0> f.pos
=> 21
irb(main):007:0> f.pos
=> 21
irb(main):008:0> f.readline
=> "ine three\n"
irb(main):009:0> f.pos
=> 32

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

Author: jmthomas (Jason Thomas)
Status: Closed
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/