Issue #6179 has been updated by jmthomas (Jason Thomas).


This does not appear to fixed in Ruby 1.9.3p194, however your test case passes. I have created the following failing test case:

  def test_pos_with_readline
    t = make_tempfile
    random = Random.new(1234)
    open(t.path, "w") do |f|
      1000.times do
        f.puts "X"*random.rand(80)
      end
    end
    i = 0
    lines = open(t.path,'r').read.split("\n")
    open(t.path, "r") do |f|
      lines.length.times do
        puts f.pos
        assert_equal lines[i], f.readline.chomp
        i += 1
      end
    end
  end

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

Author: jmthomas (Jason Thomas)
Status: Closed
Priority: Normal
Assignee: h.shirosaki (Hiroshi Shirosaki)
Category: 
Target version: 


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/