$LOADED_FEATURES is updated before loading finished
---------------------------------------------------
Key: JRUBY-5779
URL: http://jira.codehaus.org/browse/JRUBY-5779
Project: JRuby
Issue Type: Bug
Components: Core Classes/Modules
Environment: jruby 1.6.1 (ruby-1.8.7-p330) (2011-05-07 4705f9e)
(OpenJDK 64-Bit Server VM 1.6.0_22) [linux-amd64-java]
Reporter: Hiroshi Nakamura
When CRuby is loading a feature, $LOADED_FEATURES does not include the feature.
JRuby includes it.
{noformat}
% echo 'p $LOADED_FEATURES' > foo.rb
% ruby -I. -rfoo -e 'load "foo.rb"'
["enumerator.so", "/usr/local/lib/ruby/1.9.1/x86_64-linux/enc/encdb.so",
"/usr/local/lib/ruby/1.9.1/x86_64-linux/enc/trans/transdb.so"]
["enumerator.so", "/usr/local/lib/ruby/1.9.1/x86_64-linux/enc/encdb.so",
"/usr/local/lib/ruby/1.9.1/x86_64-linux/enc/trans/transdb.so",
"/home/nahi/git/jruby/foo.rb"]
% ruby187 -I. -rfoo -e 'load "foo.rb"'
["enumerator.so"]
["enumerator.so", "foo.rb"]
% jruby -I. -rfoo -e 'load "foo.rb"'
["enumerator.jar", "foo.rb"]
["enumerator.jar", "foo.rb"]
{noformat}
Following ad-hoc patch breaks LoadService. You can't build jruby because of
generate-ri-cache failure.
{noformat}
diff --git a/src/org/jruby/runtime/load/LoadService.java
b/src/org/jruby/runtime/load/LoadService.java
index b9eb6b9..a80e809 100644
--- a/src/org/jruby/runtime/load/LoadService.java
+++ b/src/org/jruby/runtime/load/LoadService.java
@@ -746,13 +746,15 @@ public class LoadService {
synchronized (loadedFeaturesInternal) {
if (featureAlreadyLoaded(loadNameRubyString)) {
return false;
- } else {
- addLoadedFeature(loadNameRubyString);
}
}
// otherwise load the library we've found
state.library.load(runtime, false);
+
+ synchronized (loadedFeaturesInternal) {
+ addLoadedFeature(loadNameRubyString);
+ }
return true;
} catch (MainExitException mee) {
// allow MainExitException to propagate out for exec and friends
{noformat}
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email