jruby-openssl icon indicating copy to clipboard operation
jruby-openssl copied to clipboard

Mimic MRI's openssl when jopenssl require fails.

Open voxik opened this issue 10 years ago • 8 comments

Some libraries (such as RubyGems [1]) rescues openssl load errors and adjust their behavior depending if the openssl is properly required. However, prior this commit, require 'openssl' succeeded just fine, but the subsequent requires failed, which makes RubyGems (and similar) to fail unexpectedly.

Please note that I submitted similar jruby/jruby/pull/2894 for 1.7 branch.

[1] https://github.com/rubygems/rubygems/blob/master/lib/rubygems/security.rb#L14

voxik avatar Apr 30 '15 10:04 voxik

Actually, RubyGems checks for e.path == 'openssl' [1] as well, so this is probably not complete patch :/ Not sure if there is better way how to make Ruby think that 'openssl' can't be required.

[1] https://github.com/rubygems/rubygems/blob/master/lib/rubygems/security.rb#L13

voxik avatar Apr 30 '15 10:04 voxik

thanks @voxik, have you tried the other way ... submitting a patch to RGs itself explaining the issue?

kares avatar Apr 30 '15 11:04 kares

@kares No, I have not, since I don't believe that RubyGems are the only library in the world using Ruby's OpenSSL. There are probably others which are doing similar check. And to be honest, I believe that most of the SW is tested against MRI and this is MRI compatibility issue.

voxik avatar Apr 30 '15 11:04 voxik

Actually, since output of jruby/jruby#2894 is totally different then anticipated, this might become less critical.

voxik avatar Apr 30 '15 11:04 voxik

@voxik disagree ... most code does defined? OpenSSL or require 'openssl' rescue-ing a LoadError. feel free to prove me wrong with another example, otherwise RG folks might be happy to fix it - if there's a real issue. you should maybe present us a valid use-case where this was an issue under JRuby.

kares avatar Apr 30 '15 15:04 kares

You describe almost precisely what RubyGems does. But if you check the links I provide above, you'd notice that they in addition check what actually was not loaded.

voxik avatar May 05 '15 08:05 voxik

@voxik did check I was asking for another example this being done in the wild (if you read my comment), until than we shall assume only RGs does the "hack" and try to come up with a solution on their side ...

kares avatar May 05 '15 10:05 kares

@kares Thanks for opening the RubyGems ticket. Hopefully they will answer soon :)

voxik avatar May 07 '15 13:05 voxik