Bug #2380
closedIO#eof? behavior different with 1.9.1p243-mingw32 than other platforms
Description
=begin
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."
=end