IO.read(1) after ungetc always returns nil
------------------------------------------
Key: JRUBY-1664
URL: http://jira.codehaus.org/browse/JRUBY-1664
Project: JRuby
Issue Type: Bug
Affects Versions: JRuby 1.x
Environment: JRuby 1.1b1, latest from trunk
Reporter: Vladimir Sizikov
Assignee: Thomas E Enebo
Attachments: io_read_after_ungetc.diff, test_io_read.rb
The simple test test_io_read.rb works incorrectly under JRuby.
The test reads one character, then pushes it back, and then reads it again via
read(1).
MRI returns: A.
JRuby returns: nil
This also leads to a Rubinius spec failure:
#>bin/mspec -V -t jruby -n jruby spec/core/io/gets_spec.rb
4)
IO#gets reads until the beginning of the next paragraph when the separator's
length is 0 FAILED
Expected nil to equal "A":
/opt/work/rubinius/spec/mini_rspec.rb:217:in `=='
/opt/work/rubinius/./spec/core/io/gets_spec.rb:63:in `=='
/opt/work/rubinius/./spec/core/io/gets_spec.rb:58:in `open'
/opt/work/rubinius/./spec/core/io/gets_spec.rb:58:in `open'
/opt/work/rubinius/./spec/core/io/gets_spec.rb:58:in `it'
/opt/work/rubinius/spec/mini_rspec.rb:355:in `it'
/opt/work/rubinius/./spec/core/io/gets_spec.rb:56:in `it'
/opt/work/rubinius/./spec/core/io/gets_spec.rb:56:in `describe'
/opt/work/rubinius/spec/mini_rspec.rb:399:in `describe'
/opt/work/rubinius/./spec/core/io/gets_spec.rb:3:in `describe'
/opt/work/rubinius/./spec/core/io/gets_spec.rb:3: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 the spec failure.
--
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