You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.
In MRI Ruby 1.9, if a partial (relative?) path to a file is included in LOADED_FEATURES, an argument to 'require' matching that path will not result in the file being reloaded. In JRuby 1.7.18 and earlier, however, the same 'require' statement would cause the file to be reloaded.
For example, if "test/testmod.rb" were added to the LOADED_FEATURES, a subsequent "require 'test/testmod'" statement on MRI Ruby 1.9 would not reload the "test/testmod.rb" file whereas the same require statement would reload the "test/testmod.rb" file on JRuby 1.7.18.
Here are a couple of test Ruby files I used to observe this:
To more closely match MRI Ruby behavior, I'm thinking that the logic behind 'require' in JRuby would need to insert each entry into LOADED_FEATURES using the partial path loaded - e.g., 'test/testmod.rb' instead of '/full/path/to/test/testmod.rb' for a require of 'test/testmod' - and also match up the path supplied to each require against the partial path to see if the file has already been loaded - i.e., if a second "require 'test/testmod'" were encountered and "test/testmod.rb" were already in LOADED_FEATURES, the "test/testmod.rb" file would not be reloaded.
Hope this makes sense. Please let me know if there are more specific examples that would be helpful to demonstrate this issue.
The text was updated successfully, but these errors were encountered:
This would probably be fixed if we did the same porting required for #2510. MRI has extensive logic during load to look for loaded features with no extension, with and without various load path entries, and so on. We have none of that logic in either 1.7 or 9k.
Due to some issues in the way that Puppet loads code, and some
differences in how that works in JRuby vs MRI Ruby, doing a
`require` on the `puppet/type/file` code multiple times in a
single JRuby interpreter will cause problems. Since this code
automatically gets loaded by Puppet before any custom
type/provider is loaded, the `require` statement is unnecessary.
This is related to the following Puppet Jira tickets:
and also to the following puppet-logstash PR:
Hopefully there will be a more permanent fix in JRuby at some point:
But in the meantime, this simple workaround makes `file_concat`
compatible with Puppet Server.