Skip to content

Commit

Permalink
Merge branch 'jruby-9.1'
Browse files Browse the repository at this point in the history
headius committed Apr 17, 2018

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
2 parents 2f4cb26 + c95601e commit 1cc0674
Showing 5 changed files with 6 additions and 35 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -83,7 +83,7 @@ target
test/pom.xml
test/prawn
test/rails
test/testapp/testapp
test/jruby/testapp/testapp
tool/nailgun/Makefile
tool/nailgun/config.log
tool/nailgun/config.status
2 changes: 1 addition & 1 deletion core/src/main/java/org/jruby/AbstractRubyMethod.java
Original file line number Diff line number Diff line change
@@ -106,7 +106,7 @@ public String getMethodName() {

@JRubyMethod(name = "owner")
public IRubyObject owner(ThreadContext context) {
return method.getRealMethod().getDefinedClass();
return implementationModule;
}

@JRubyMethod(name = "source_location")
5 changes: 0 additions & 5 deletions core/src/main/java/org/jruby/RubyMethod.java
Original file line number Diff line number Diff line change
@@ -312,11 +312,6 @@ public IRubyObject receiver(ThreadContext context) {
return receiver;
}

@JRubyMethod
public IRubyObject owner(ThreadContext context) {
return implementationModule;
}

@JRubyMethod
public IRubyObject source_location(ThreadContext context) {
Ruby runtime = context.runtime;
30 changes: 3 additions & 27 deletions core/src/main/java/org/jruby/util/ShellLauncher.java
Original file line number Diff line number Diff line change
@@ -411,38 +411,14 @@ private static File findPathFile(Ruby runtime, String fname, String[] path, bool
return pathFile;
}

/**
* This is an older version of the path-finding logic used by our pure-Java process launching in backquote,
* system, etc. The newer version below, used by native process launching, appears to break execution of commands
* in the current working directory, e.g. "./testapp".
*
* MRI: Older version of logic for dln_find_exe_r used by popen logic
*/
public static File findPathExecutable(Ruby runtime, String fname) {
RubyHash env = (RubyHash) runtime.getObject().getConstant("ENV");
IRubyObject pathObject = env.op_aref(runtime.getCurrentContext(), RubyString.newString(runtime, PATH_ENV));
String[] pathNodes = null;
if (pathObject == null) {
pathNodes = DEFAULT_PATH; // ASSUME: not modified by callee
}
else {
String pathSeparator = System.getProperty("path.separator");
String path = pathObject.toString();
if (Platform.IS_WINDOWS) {
// Windows-specific behavior
path = "." + pathSeparator + path;
}
pathNodes = path.split(pathSeparator);
}
return findPathFile(runtime, fname, pathNodes, true);
return findPathExecutable(runtime, fname, pathObject);
}

/**
* Search for the given executable using the given PATH or one provided by system defaults.
*
* This is the updated version of MRI: dln_find_exe_r logic.
*/
public static File dlnFindExe(Ruby runtime, String fname, IRubyObject pathObject) {
// MRI: Hopefully close to dln_find_exe_r used by popen logic
public static File findPathExecutable(Ruby runtime, String fname, IRubyObject pathObject) {
String[] pathNodes;

if (pathObject == null || pathObject.isNil()) {
2 changes: 1 addition & 1 deletion core/src/main/java/org/jruby/util/io/PopenExecutor.java
Original file line number Diff line number Diff line change
@@ -2011,7 +2011,7 @@ public int compare(String o1, String o2) {
}

private static String dlnFindExeR(Ruby runtime, String fname, IRubyObject path) {
File exePath = ShellLauncher.dlnFindExe(runtime, fname, path);
File exePath = ShellLauncher.findPathExecutable(runtime, fname, path);
return exePath != null ? exePath.getAbsolutePath() : null;
}

0 comments on commit 1cc0674

Please sign in to comment.