Skip to content
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

IRB help doesn't work form jruby complete as files embedded in jars are not rewindable #3584

Open
grddev opened this issue Jan 7, 2016 · 1 comment

Comments

@grddev
Copy link
Contributor

grddev commented Jan 7, 2016

The following command prints an empty help message:

java -jar maven/jruby-complete/target/jruby-complete-9.0.5.0-SNAPSHOT.jar -S irb -h

This used to work for JRuby 1.7.x (but only by accident).

The JRuby 9K command can essentially be reduced to the following:

java -jar maven/jruby-complete/target/jruby-complete-9.0.5.0-SNAPSHOT.jar -e 'puts File.open("classpath:/META-INF/jruby.home/lib/ruby/stdlib/irb/lc/help-message").tap(&:gets).tap(&:rewind).read'

By removing either tap(&:gets) or tap(&:rewind) from the above command, the help message is printed instead of an empty line.

It seems that rewind (and seek in general) fails for a file embedded in a jar, without actually signaling in any way that it is failing, which means that unreading the contents buffered by gets is just discarded.

In JRuby 1.7.x, rewind also doesn't work, but it doesn't discard anything, so from IRB's perspective, where the first line is discarded later anyhow, everything "works" as expected.

This was discovered when trying to get the integration specs for puck to run on JRuby 9K (see iconara/puck#28). In the context of that project, files embedded in a jar file would ideally not be different from files outside jar files, but making them truly rewindable seems rather complicated.

@chrisseaton
Copy link
Contributor

#3579 may be related

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants