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
Can't seek when file accessed using classpath: OR uri:classloader: schemes #3399
Comments
The same problem exists for the uri:classloader scheme.
|
Same issue via this route (foo.rb in a jar):
|
And here's a full backtrace of how we first encountered the issue, to give you a sense of how impactful this issue is.
|
Confirmed that the same is true w/ JRuby 9.0.0.0 |
Ok, I'm not sure the best way to handle this. Did you say it works on 1.7? The stream we get from the in-jar files is a JarURLInputStream. The only public ancestor of that is FilterInputStream, which doesn't support seeking (it supports mark/reset but I'm not sure that's enough). The JarURLInputStream appears to wrap a ZipFileInputStream or ZipFileInflaterInputStream. They don't support seeking either. What is the use case you're trying to solve? It may be simpler for you to just read in-jar files into a binary String and then use StringIO to simulate random access. |
Basically, Rack will read the file and seek within it, see stack trace above. So we aren't actually doing the seeking Rack is doing it transitively. On 1.7.19 this doesn't happen via the jar::file path that was produced via File.expand_path. |
@r6p Ok, I think I figured it out. Apparently I determined at one point that only selectable channels (e.g. sockets, pipes) should raise errors when you try to seek on them. I'll see about making the same change to 9k. |
Any chance for a 9.0.1.1 release w/ this fix? |
9.0.1.1 would be a security fix release. This will go into 9.0.2.0 shortly. |
Great thanks. Let me know if you want me to verify against a build from HEAD if that is helpful. |
@r6p Verification is always welcome :-) |
We're working on pushing out a release today. |
@headius that's awesome. Many thanks! |
@headius thanks again! I just verified using the public v9.0.3.0 release. |
@r6p Thanks! |
Error case followed by success case below. This issue breaks Sinatra AssetPack running on JRuby 9.0.1.0 when the Sinatra "root" directory is set using the classpath: scheme.
The text was updated successfully, but these errors were encountered: