IO.each_line incorrectly reads empty lines
------------------------------------------
Key: JRUBY-1663
URL: http://jira.codehaus.org/browse/JRUBY-1663
Project: JRuby
Issue Type: Bug
Environment: JRuby 1.1b1, latest trunk.
Reporter: Vladimir Sizikov
Assignee: Thomas E Enebo
Attachments: io_each_line.diff, test_io_each_line.rb
JRuby incorrectly reads empty lines in files.
The attached test reads 20 empty lines from the file via IO.each_line and
produces:
MRI:
Read 20 lines
JRuby
Read 10 lines
This problem also triggers a number of Rubinius spec failures for IO.
E.g.:
# bin/mspec -t jruby spec/core/io/each_line_spec.rb
IO#each_line yields the next line of string that is separated by $/ FAILED
Expected "\n\n" to equal "\n":
/opt/work/rubinius/spec/mini_rspec.rb:217:in `=='
/opt/work/rubinius/./spec/core/io/shared/each.rb:12:in `=='
/opt/work/rubinius/./spec/core/io/shared/each.rb:12:in `each_line'
/opt/work/rubinius/./spec/core/io/shared/each.rb:12:in `each_line'
/opt/work/rubinius/./spec/core/io/shared/each.rb:12:in `open'
/opt/work/rubinius/./spec/core/io/shared/each.rb:10:in `open'
/opt/work/rubinius/./spec/core/io/shared/each.rb:12:in `it'
/opt/work/rubinius/spec/mini_rspec.rb:355:in `it'
/opt/work/rubinius/./spec/core/io/shared/each.rb:9:in `it'
/opt/work/rubinius/./spec/core/io/shared/each.rb:9:in `describe'
/opt/work/rubinius/spec/mini_rspec.rb:399:in `describe'
/opt/work/rubinius/./spec/core/io/shared/each.rb:8:in `describe'
/opt/work/rubinius/./spec/core/io/shared/each.rb:8:in `call'
/opt/work/rubinius/./spec/core/io/../../spec_helper.rb:154:in `it_behaves_like'
/opt/work/rubinius/./spec/core/io/each_line_spec.rb:5:in `it_behaves_like'
/opt/work/rubinius/./spec/core/io/each_line_spec.rb:4:in `describe'
/opt/work/rubinius/spec/mini_rspec.rb:399:in `describe'
/opt/work/rubinius/./spec/core/io/each_line_spec.rb:4:in `describe'
/opt/work/rubinius/./spec/core/io/each_line_spec.rb:4:in `load'
last_mspec.rb:11:in `load'
last_mspec.rb:1:in `each'
last_mspec.rb:6:in `each'
The proposed patch fixes the problem and quite some number of spec failures:
Before patch: 248 failures in core specs.
After patch: 241 failures.
All JRuby test pass.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe from this list please visit:
http://xircles.codehaus.org/manage_email