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

load path with jars not working anymore with 1.7.16 #2017

Closed
mkristian opened this Issue Oct 2, 2014 · 8 comments

Comments

Projects
None yet
6 participants
@mkristian
Copy link
Member

commented Oct 2, 2014

LOAD_PATH entries with jar:file:./my.jar! do work but entries with jar:file:./my.jar!/ do not work any more with jruby-1.7.16 or jruby-1.7.15 (or jruby-1.7.14).

create a jar with two ruby scripts:
echo "puts 'hello'" > hello1.rb; cp hello1.rb hello2.rb; jar -cf my.jar hello*.rb; rm hello*.rb

execute it with jruby 1.7.13

$ java -jar /usr/local/repository/org/jruby/jruby-complete/1.7.13/jruby-complete-1.7.13.jar test.rb
1.7.13
file:/usr/local/repository/org/jruby/jruby-complete/1.7.13/jruby-complete-1.7.13.jar!/META-INF/jruby.home/lib/ruby/1.9/site_ruby
file:/usr/local/repository/org/jruby/jruby-complete/1.7.13/jruby-complete-1.7.13.jar!/META-INF/jruby.home/lib/ruby/shared
file:/usr/local/repository/org/jruby/jruby-complete/1.7.13/jruby-complete-1.7.13.jar!/META-INF/jruby.home/lib/ruby/1.9
jar:file:./my.jar!
hello
file:/usr/local/repository/org/jruby/jruby-complete/1.7.13/jruby-complete-1.7.13.jar!/META-INF/jruby.home/lib/ruby/1.9/site_ruby
file:/usr/local/repository/org/jruby/jruby-complete/1.7.13/jruby-complete-1.7.13.jar!/META-INF/jruby.home/lib/ruby/shared
file:/usr/local/repository/org/jruby/jruby-complete/1.7.13/jruby-complete-1.7.13.jar!/META-INF/jruby.home/lib/ruby/1.9
jar:file:./my.jar!/
hello

and with jruby-1.7.16

 $ java -jar /usr/local/repository/org/jruby/jruby-complete/1.7.16/jruby-complete-1.7.16.jar test.rb
1.7.16
file:/usr/local/repository/org/jruby/jruby-complete/1.7.16/jruby-complete-1.7.16.jar!/META-INF/jruby.home/lib/ruby/1.9/site_ruby
file:/usr/local/repository/org/jruby/jruby-complete/1.7.16/jruby-complete-1.7.16.jar!/META-INF/jruby.home/lib/ruby/shared
file:/usr/local/repository/org/jruby/jruby-complete/1.7.16/jruby-complete-1.7.16.jar!/META-INF/jruby.home/lib/ruby/1.9
jar:file:./my.jar!
hello
file:/usr/local/repository/org/jruby/jruby-complete/1.7.16/jruby-complete-1.7.16.jar!/META-INF/jruby.home/lib/ruby/1.9/site_ruby
file:/usr/local/repository/org/jruby/jruby-complete/1.7.16/jruby-complete-1.7.16.jar!/META-INF/jruby.home/lib/ruby/shared
file:/usr/local/repository/org/jruby/jruby-complete/1.7.16/jruby-complete-1.7.16.jar!/META-INF/jruby.home/lib/ruby/1.9
jar:file:./my.jar!/
LoadError: no such file to load -- hello2
  require at org/jruby/RubyKernel.java:1065
  require at /usr/local/repository/org/jruby/jruby-complete/1.7.16/jruby-complete-1.7.16.jar!/META-INF/jruby.home/lib/ruby/shared/rubygems/core_ext/kernel_require.rb:55
   (root) at test.rb:10
@nirvdrum

This comment has been minimized.

Copy link
Contributor

commented Oct 2, 2014

Ping @ratnikov.

@mkristian

This comment has been minimized.

Copy link
Member Author

commented Oct 3, 2014

this actual means that package goal of the gem-maven-plugin only works with jruby version 1.7.12 and older.

@ratnikov

This comment has been minimized.

Copy link
Contributor

commented Oct 4, 2014

sigh Stupid gmail considering github updates as "Forum" >.<

I'll take a look at it on Monday. We definitely need to keep beefing out test suite to cover all these corner cases.

@mkristian

This comment has been minimized.

Copy link
Member Author

commented Oct 5, 2014

it look very much that there are still other problems around path strings which are actually jar:file: URI like jruby/jruby-openssl#11

another case where I got problems with this was dd52792
where sometimes it was a jar:file: and sometimes not. sometimes the jar:file: uri was escaped (toExternalForm()) and sometimes not.

@kares

This comment has been minimized.

Copy link
Member

commented Oct 5, 2014

@mkristian is it a good idea to hack around tests instead of 'em failing (and fixing the underlying issues) ?

@mkristian

This comment has been minimized.

Copy link
Member Author

commented Oct 5, 2014

@kares I see if I can get failing tests on travis pass the "gem install" problem of jruby-openssl

@mkristian

This comment has been minimized.

Copy link
Member Author

commented Oct 5, 2014

@kares I tried to configure the gem-maven-plugin not to use the latest 1.7.17-snapshot for installing the gems, but it is not possible since the plugin inherits the maven-project classloader (class-realm in maven speak) and here I need the latest jruby snapshot since this is one which gets tested. but probably I did not understood your question.

anyway the test are still failing - well not the tests but the setup of those tests.

regarding dd52792

yes that is a hack and should not reach the actual branch. but the problem is that the same path can have at least 3 different representations which are all treated OK. but in that test assumes there is only ONE representation. so the question is who they are represented internally and how they are detected when they come in as strings, like "/jruby-stdlib-1.7.17-SNAPSHOT.jar!/META-INF/" is this a jar uri or a path on the filesystem. it is definitely a valid path with a directory having a name ending in "!". same holds true for "file:/jruby-stdlib-1.7.17-SNAPSHOT.jar!/META-INF/" but juby currently gets "translated" into "jar:file:/jruby-stdlib-1.7.17-SNAPSHOT.jar!/META-INF/". the latter is just not the same from java point of view but are treated the same from jruby point of view.

so I can not fix the underlying issue since any fix will break things here or there. maybe someone just decides what is wanted.

@mkristian

This comment has been minimized.

Copy link
Member Author

commented Nov 11, 2014

for the record - I missed to add my test.rb script:

$LOAD_PATH << 'jar:file:./my.jar!/'
require 'hello1'

$LOAD_PATH << 'jar:file:./my.jar!'
require 'hello2'

mkristian added a commit that referenced this issue Nov 11, 2014

allow both "jar:file:./my.jar!/" and "jar:file:./my.jar!" as LOAD_PAT…
…H entries

this was a regression introduced with jruby-1.7.13 - fixes #2017

Sponsored by Lookout Inc.

mkristian added a commit that referenced this issue Nov 11, 2014

allow both "jar:file:./my.jar!/" and "jar:file:./my.jar!" as LOAD_PAT…
…H entries

this was a regression introduced with jruby-1.7.13 - fixes #2017

Sponsored by Lookout Inc.

@mkristian mkristian closed this Nov 13, 2014

yousuketto added a commit to yousuketto/jruby that referenced this issue Nov 22, 2014

allow both "jar:file:./my.jar!/" and "jar:file:./my.jar!" as LOAD_PAT…
…H entries

this was a regression introduced with jruby-1.7.13 - fixes jruby#2017

Sponsored by Lookout Inc.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.