-
-
Notifications
You must be signed in to change notification settings - Fork 925
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
Symlinks in load path should remain unexpanded in LOADED_FEATURES #1941
Comments
This isn't going to make 1.7.16. I started looking into the logic in MRI, and it's enormous and very dense. |
@headius Did you happen to notice this difference or did this break something? |
We have run into a couple of cases where the differences in how $LOADED_FEATURES works in MRI Ruby 1.9.3 vs. JRuby 1.7.16 under Ruby 1.9 has caused problems for the puppet-server project, https://github.com/puppetlabs/puppet-server. In Puppet Ruby code, we have some logic which manipulates the $LOADED_FEATURES array directly in some cases where we need to manually manage the load process. The differences in MRI Ruby vs. JRuby interpretation of that array when a "require" is performed causes code to be errantly to be reloaded, which is problematic for us. Here are the cases we've seen:
Can you confirm that the issues we found above are the same as what this issue is covering? If you think there's anything new here that warrants a separate issue, I'd be happy to create a new issue to cover that. |
@camlow325 That does sound like the same issues. I'm not sure if we're going to be able to get this in for 1.7.17, given that we've already delayed that release too long. Would it be possible for you to come up with some test cases for the issues you've seen? It would provide a good starting point for fixing them. |
@ratnikov Actually, this might be something you'd be able to fix up quickly, since you've reworked so much of the loading logic. Or perhaps you can just point us (me and others looking at this bug) at the right place where LOADED_FEATURES is populated. |
It's resolveLoadPath which is used here: https://github.com/jruby/jruby/blob/jruby-1_7/core/src/main/java/org/jruby/runtime/load/LibrarySearcher.java#L216 And for 1.9 is defined as canonicalPath (https://github.com/jruby/jruby/blob/jruby-1_7/core/src/main/java/org/jruby/runtime/load/LibrarySearcher.java#L216). |
@headius, Is this comment accurate: https://github.com/jruby/jruby/blob/jruby-1_7/core/src/main/java/org/jruby/util/RegularFileResource.java#L43 ? Or does it apply only to files, and not LOADED_FEATURES? |
@ratnikov I believe it only applies to files. It's pretty easy to show that MRI does absolutize but does not canonicalize features with symlinks. Note here I'm using the JDK definition of absolute and canonical, where canonical means to expand all symlinks.
May just require switching a call...I will try it, but I have bumped this to 1.7.18 so we can let the change bake for a couple weeks. |
Regression spec added in 4c3fa76. Not sure why it didn't link to this issue. |
This is related to #1940.
When a load path contains an entry with an embedded symlink, JRuby will canonicalize LOADED_FEATURES entries through that symlink. This can lead to issues similar to rubygems/bundler#3164, though that specific issue appears to be fixed by avoiding canonicalization of FILE (#1940).
We should try to iron out exactly how and when MRI expands absolute paths and canonicalizes through symlinks for JRuby 1.7.16, so we can put this to rest. We also need tests or specs for all permutations, because both MRI's suite and RubySpec are weak here.
The text was updated successfully, but these errors were encountered: