[RubySpec][1.9] Removing '.' from default load path causes specs not to run
---------------------------------------------------------------------------
Key: JRUBY-5251
URL: http://jira.codehaus.org/browse/JRUBY-5251
Project: JRuby
Issue Type: Bug
Components: Ruby 1.9, RubySpec
Reporter: Charles Oliver Nutter
Assignee: Thomas E Enebo
Fix For: JRuby 1.6
This is a peculiar one. If I fix the RubySpec language/predefined which checks
that '.' is not part of the default load path, a simple "mspec-run" or
"mspec-ci" no longer finds our config and no longer runs specs. I must specify
--config spec/jruby.1.9.mspec to get the specs to run again.
It appears some behavior in mspec is checking . and ./spec for the config file
to run, and with the Ruby 1.9 change it is no longer able to locate that file.
I confirmed that if I try to run mspec using Ruby 1.9 from a dir above
RubySpec, it does not find the config/specs, while Ruby 1.8 finds them just
fine.
This may require a patch to mspec, to be able to load the config without . in
load path.
Here is the patch (I won't be committeding yet) for removing '.' from load path:
{noformat}
diff --git a/spec/tags/1.9/ruby/language/predefined_tags.txt
b/spec/tags/1.9/ruby/language/predefined_tags.txt
index fa09cb5..86aebc1 100644
--- a/spec/tags/1.9/ruby/language/predefined_tags.txt
+++ b/spec/tags/1.9/ruby/language/predefined_tags.txt
@@ -1,2 +1 @@
fails:Execution variable $: does not include the current directory
-windows:Execution variable $: does not include '.' when the taint check level
> 1
diff --git a/src/org/jruby/runtime/load/LoadService.java
b/src/org/jruby/runtime/load/LoadService.java
index e32b289..002828c 100644
--- a/src/org/jruby/runtime/load/LoadService.java
+++ b/src/org/jruby/runtime/load/LoadService.java
@@ -217,7 +217,7 @@ public class LoadService {
} catch(SecurityException ignore) {}
// "." dir is used for relative path loads from a given file, as in
require '../foo/bar'
- if (runtime.getSafeLevel() == 0) {
+ if (!runtime.is1_9() && runtime.getSafeLevel() == 0) {
addPath(".");
}
}
diff --git a/src/org/jruby/util/io/ChannelDescriptor.java
b/src/org/jruby/util/io/ChannelDescriptor.java
index d7f03f7..8765e62 100644
--- a/src/org/jruby/util/io/ChannelDescriptor.java
+++ b/src/org/jruby/util/io/ChannelDescriptor.java
@@ -51,6 +51,7 @@ import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.jar.JarFile;
import java.util.zip.ZipEntry;
+import org.jruby.Ruby;
import org.jruby.RubyFile;
import org.jruby.ext.posix.POSIX;
@@ -715,7 +716,7 @@ public class ChannelDescriptor {
}
} else if (path.startsWith("classpath:/")) {
path = path.substring("classpath:/".length());
- InputStream is =
ByteList.EMPTY_BYTELIST.getClass().getClassLoader().getResourceAsStream(path);
+ InputStream is = Ruby.getClassLoader().getResourceAsStream(path);
// FIXME: don't use RubyIO for this
return new ChannelDescriptor(Channels.newChannel(is), flags);
} else {
{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