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
Closed

load path with jars not working anymore with 1.7.16 #2017

mkristian opened this issue Oct 2, 2014 · 8 comments
Assignees
Milestone

Comments

@mkristian
Copy link
Member

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
Copy link
Contributor

nirvdrum commented Oct 2, 2014

Ping @ratnikov.

@mkristian
Copy link
Member Author

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

@ratnikov
Copy link
Contributor

ratnikov 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
Copy link
Member Author

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
Copy link
Member

kares commented Oct 5, 2014

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

@mkristian
Copy link
Member Author

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

@mkristian
Copy link
Member Author

@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
Copy link
Member Author

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
…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
…H entries

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

Sponsored by Lookout Inc.
yousuketto pushed a commit to yousuketto/jruby that referenced this issue Nov 22, 2014
…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
Projects
None yet
Development

No branches or pull requests

6 participants