Skip to content

Commit

Permalink
since "." is on the classpath the executables in ./bin should be trea…
Browse files Browse the repository at this point in the history
…ted as files

jruby always looks on classpath in 'bin' for executables but finding
it there leads to uri:classloader:/bin/rails which can have side effects.
looking first on the filesystem ./bin will find bin/rails instead.

fixes #3233 and partially #3216

Sponsored by Lookout Inc.
mkristian committed Aug 7, 2015
1 parent 6521fde commit c925dbf
Showing 3 changed files with 28 additions and 0 deletions.
4 changes: 4 additions & 0 deletions core/src/main/java/org/jruby/util/cli/ArgumentProcessor.java
Original file line number Diff line number Diff line change
@@ -648,6 +648,10 @@ private String resolveScript(String scriptName) {
if (result != null) return scriptName;// use relative filename
result = resolve(config.getJRubyHome() + "/bin", scriptName);
if (result != null) return result;
// since the current directory is also on the classpath we
// want to find it on filesystem first
result = resolve(config.getCurrentDirectory() + "/bin", scriptName);
if (result != null) return result;
result = resolve("uri:classloader:/bin", scriptName);
if (result != null) return result;

19 changes: 19 additions & 0 deletions maven/jruby-complete/src/it/integrity/pom.xml
Original file line number Diff line number Diff line change
@@ -178,6 +178,25 @@
</arguments>
</configuration>
</execution>
<execution>
<id>-S me - GH-3233</id>
<phase>test</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>java</executable>
<arguments>
<argument>-classpath</argument>
<argument>.</argument>
<argument>-classpath</argument>
<classpath/>
<argument>org.jruby.Main</argument>
<argument>-S</argument>
<argument>me</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
5 changes: 5 additions & 0 deletions maven/jruby-complete/src/it/integrity/verify.bsh
Original file line number Diff line number Diff line change
@@ -48,3 +48,8 @@ if ( !log.contains( expected ) )
{
throw new RuntimeException( "log file does not contain '" + expected + "'" );
}
expected = basedir + "/bin/me";
if ( !log.contains( expected ) )
{
throw new RuntimeException( "log file does not contain '" + expected + "'" );
}

0 comments on commit c925dbf

Please sign in to comment.