Skip to content

loading pem files from jar file location does not work #11

Closed
@mkristian

Description

@mkristian

when installing gem using jruby-complete or the modular jruby artifact does not work anymore - not sure why it works with older jruby-openssl.

the offending line from rubygems is
https://github.com/jruby/jruby/blob/jruby-1_7/lib/ruby/shared/rubygems/request.rb#L34

the problem here is that file locations are either a string like this:

/usr/local/repository/org/jruby/jruby-stdlib/1.7.17-SNAPSHOT/jruby-stdlib-1.7.17-SNAPSHOT.jar!/META-INF/jruby.home/lib/ruby/shared/rubygems/ssl_certs/Class3PublicPrimaryCertificationAuthority.pem 

or within the jruby/jruby#1957 where it is something like this

uri:classloader:/META-INF/jruby.home/lib/ruby/shared/rubygems/ssl_certs/Class3PublicPrimaryCertificationAuthority.pem

also file location like this do not work

jar:file:/usr/local/repository/org/jruby/jruby-stdlib/1.7.17-SNAPSHOT/jruby-stdlib-1.7.17-SNAPSHOT.jar!/META-INF/jruby.home/lib/ruby/shared/rubygems/ssl_certs/Class3PublicPrimaryCertificationAuthority.pem

well, the problem is obvious, the first string is not even an uri and as such a valid path (with one directory having a name ending in !)
the other problem is
https://github.com/jruby/jruby-openssl/blob/master/src/main/java/org/jruby/ext/openssl/X509Store.java#L147
where is assumes it is a path argument and not some "uri" kind of argument.

translating the uri-like location to URI or URL is kind of tricky since it needs the runtime to maybe find the right URL - something like:
https://github.com/jruby/jruby/blob/test-load-from-jruby-classloader/core/src/main/java/org/jruby/runtime/load/LibrarySearcher.java#L280

@ratnikov maybe you have an idea how go about this. since I think it is general problem not restricted to jruby-openssl.

easy way to reproduce it with rmvn initialize and Mavenfile:

gem 'maven-tools', '1.0.5'
jruby_plugin :gem do execute_goal :initialize; end
jar 'org.jruby', 'jruby', '1.7.17-SNAPSHOT'
properties 'tesla.dump.pom' => 'pom.xml', 'jruby.version'=> '1.7.17-SNAPSHOT'

which will use the jruby-stdlib-1.7.17-SNAPSHOT.jar build with mvn -Pmain

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions