From: Ian Dees Date: 2009-11-18T07:16:05+09:00 Subject: [ruby-core:26788] [Bug #2380] IO#eof? behavior different with 1.9.1p243-mingw32 than other platforms Bug #2380: IO#eof? behavior different with 1.9.1p243-mingw32 than other platforms http://redmine.ruby-lang.org/issues/show/2380 Author: Ian Dees Status: Open, Priority: Normal Category: core ruby -v: ruby 1.9.1p243 (2009-07-16 revision 24175) [i386-mingw32] In the following code: open('somefile.txt', 'r') do |f| until f.eof? do raise 'nil character' if f.getc.nil? end end The code runs without error in both Ruby 1.8 and 1.9 on Ubuntu, and 1.8 on Win32. The call to eof? returns true and prevents getc from being called in a situation that would return nil. But Ruby 1.9 on Win32 throws the "nil character" exception shown. This difference disrupts tools like autospec, which opens a pipe to a subprocess and reads the results character by character. Luis Lavena offers the following observations after his own tests of the issue: "I just tested exact same example with 1.8.6 without errors (somefile containing both LF or CRLF).... I can confirm this fails with 1.9.1 patchelvel 243, but works with patchlevel 129, which indicates a regression in Ruby." ---------------------------------------- http://redmine.ruby-lang.org