-
-
Notifications
You must be signed in to change notification settings - Fork 925
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
IO#seek and tell do not properly handle offsets larger than int32 #3817
Comments
See #3664 for another report partially fixed by #3435. See jnr/jnr-posix#71 for a PR to fix at least some of these APIs in jnr-posix. |
I had some trouble figuring out how to test this. |
I had a small (well, not file size small, but code small) test case when I reported this on #3664 that could be potentially adapted as a unit test provided you have 3G/5G of disk space |
@byteit101 Yeah it's the file size I'm concerned about. I was able to use /dev/zero to test the jnr-posix fix, but that seems to blow up for me with ruby. |
Oh nevermind...I had reversed seek params. Test coming. |
Hi is this issue fixed now on newer jrubies? |
This is still broken in s = StringIO.new
s.seek(2**31-1)
=> 0
s.seek(2**31)
RangeError (integer 2147483648 too big to convert to `int') |
Environment
JRuby 9.1
Expected Behavior
IO#seek
andIO#tell
should handle offsets larger than int32 rangeActual Behavior
As seen in #3435, we were not handling the return value of
lseek
properly, interpreting all negative values as error rather than just -1. That was fixed, but the larger issue is that our nativelseek
and much of the code that calls it only supports int32 range.I have a commit coming shortly to fix the main #3435 issue, but this large problem needs to be addressed after 9.1.
The text was updated successfully, but these errors were encountered: