Issue Details (XML | Word | Printable)

Key: JRUBY-3276
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Thomas E Enebo
Reporter: Charles Oliver Nutter
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
JRuby

New IO#readpartial and IO#seek spec failures

Created: 31/Dec/08 02:43 AM   Updated: 21/Mar/09 01:14 PM
Component/s: RubySpec
Affects Version/s: None
Fix Version/s: JRuby 1.2

Time Tracking:
Not Specified

File Attachments: 1. Text File io_readpartial.patch (2 kB)



 Description  « Hide
A few new failures in readpartial and seek specs:
1)
IO#readpartial discards the existing buffer content upon successful read FAILED
Expected "existinghello world"
 to equal "hello world"

spec/ruby/core/io/readpartial_spec.rb:55
spec/ruby/core/io/readpartial_spec.rb:4
spec/ruby/core/io/readpartial_spec.rb:54:in `load'

2)
IO#readpartial discards the existing buffer content upon error FAILED
Expected EOFError but no exception was raised
spec/ruby/core/io/readpartial_spec.rb:61
spec/ruby/core/io/readpartial_spec.rb:4
spec/ruby/core/io/readpartial_spec.rb:54:in `load'

3)
IO#readpartial raises IOError if the stream is closed FAILED
Expected IOError but no exception was raised
spec/ruby/core/io/readpartial_spec.rb:67
spec/ruby/core/io/readpartial_spec.rb:4
spec/ruby/core/io/readpartial_spec.rb:54:in `load'

4)
IO#seek moves the read position and clears EOF with SEEK_CUR FAILED
Expected 10
 to equal nil

spec/ruby/core/io/seek_spec.rb:64
spec/ruby/core/io/seek_spec.rb:4
spec/ruby/core/io/seek_spec.rb:54:in `load'

5)
IO#seek moves the read position and clears EOF with SEEK_END FAILED
Expected 10
 to equal nil

spec/ruby/core/io/seek_spec.rb:71
spec/ruby/core/io/seek_spec.rb:4
spec/ruby/core/io/seek_spec.rb:54:in `load'


 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
coderrr added a comment - 05/Jan/09 01:48 PM
This patch fixes IO#readpartial in RubyIO.java to raise EOFError on eof. Currently it will return "" forever on eof. This patch also clears the output buffer if one is passed. All current readpartial_spec.rb test failures now pass:

$ mspec -t j readpartial_spec.rb
jruby 1.1.7 (ruby 1.8.6 patchlevel 114) (2009-01-06 rev 8588) [i386-java]
....FFFF..

1)
IO#readpartial discards the existing buffer content upon successful read FAILED
Expected "existinghello world"
to equal "hello world"

readpartial_spec.rb:55
readpartial_spec.rb:4
readpartial_spec.rb:54:in `load'

2)
IO#readpartial raises EOFError on EOF FAILED
Expected EOFError but no exception was raised
readpartial_spec.rb:62
readpartial_spec.rb:4
readpartial_spec.rb:54:in `load'

3)
IO#readpartial discards the existing buffer content upon error FAILED
Expected EOFError but no exception was raised
readpartial_spec.rb:68
readpartial_spec.rb:4
readpartial_spec.rb:54:in `load'

4)
IO#readpartial raises IOError if the stream is closed FAILED
Expected IOError but no exception was raised
readpartial_spec.rb:74
readpartial_spec.rb:4
readpartial_spec.rb:54:in `load'

after 'patch -p0 < io_readpartial.patch'

$ mspec -t j readpartial_spec.rb
jruby 1.1.7 (ruby 1.8.6 patchlevel 114) (2009-01-06 rev 8588) [i386-java]
..........


Thomas E Enebo added a comment - 05/Jan/09 06:57 PM
Fixed in commit 8606 (initial patch by coderrr). I fixed a few other things along the way and even made a shared method so that read_nonblock could share it. Thanks for the patch. Keep it up!