Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: jruby/jruby
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 8e29ae1302e7
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 249a2911e007
Choose a head ref
  • 8 commits
  • 6 files changed
  • 1 contributor

Commits on Feb 16, 2016

  1. [build] update compiler plugin

    kares committed Feb 16, 2016
    Copy the full SHA
    a02628a View commit details
  2. Copy the full SHA
    a5c9372 View commit details
  3. Copy the full SHA
    b7f7d31 View commit details
  4. Copy the full SHA
    3f273c4 View commit details
  5. Copy the full SHA
    94a13c0 View commit details
  6. handle :gid/:uid popen options as unimplemented instead of raising Ar…

    …gumentError
    
    ... a unsupported warning might have worked as well but not sure if its a good idea
    kares committed Feb 16, 2016
    Copy the full SHA
    aaddd18 View commit details
  7. Copy the full SHA
    d1eecd1 View commit details
  8. Copy the full SHA
    249a291 View commit details
24 changes: 6 additions & 18 deletions core/src/main/java/org/jruby/RubyIO.java
Original file line number Diff line number Diff line change
@@ -3743,13 +3743,13 @@ private void setupPopen(ModeFlags modes, POpenProcess process) throws RaiseExcep
}

private static class Ruby19POpen {
public final RubyString cmd;
public final IRubyObject[] cmdPlusArgs;
public final RubyHash env;
final RubyString cmd;
final IRubyObject[] cmdPlusArgs;
final RubyHash env;

public Ruby19POpen(Ruby runtime, IRubyObject[] args) {
IRubyObject[] _cmdPlusArgs = null;
IRubyObject _env = null;
Ruby19POpen(Ruby runtime, IRubyObject[] args) {
IRubyObject[] _cmdPlusArgs;
IRubyObject _env;
IRubyObject _cmd;

int firstArg = 0;
@@ -3865,18 +3865,6 @@ public static IRubyObject popen(ThreadContext context, IRubyObject recv, IRubyOb
process = ShellLauncher.popen(runtime, r19Popen.cmdPlusArgs, r19Popen.env, modes);
}

// Yes, this is gross. java.lang.Process does not appear to be guaranteed
// "ready" when we get it back from Runtime#exec, so we try to give it a
// chance by waiting for 10ms before we proceed. Only doing this on 1.5
// since Hotspot 1.6+ does not seem to exhibit the problem.
if (System.getProperty("java.specification.version", "").equals("1.5")) {
synchronized (process) {
try {
process.wait(100);
} catch (InterruptedException ie) {}
}
}

checkPopenOptions(options);

io.setupPopen(modes, process);
21 changes: 14 additions & 7 deletions core/src/main/java/org/jruby/RubyKernel.java
Original file line number Diff line number Diff line change
@@ -1553,7 +1553,7 @@ public static IRubyObject system19(ThreadContext context, IRubyObject recv, IRub
if (pid < 0) {
return runtime.getNil();
}
status[0] = (int)((RubyProcess.RubyStatus)context.getLastExitStatus()).getStatus();
status[0] = (int)((RubyProcess.RubyStatus) context.getLastExitStatus()).getStatus();
if (status[0] == 0) return runtime.getTrue();
return runtime.getFalse();
}
@@ -1582,11 +1582,7 @@ private static int systemCommon(ThreadContext context, IRubyObject recv, IRubyOb
long[] tuple;

try {
IRubyObject lastArg = args[args.length - 1];
if (lastArg instanceof RubyHash) {
runtime.getWarnings().warn(ID.UNSUPPORTED_SUBPROCESS_OPTION, "system does not support options in JRuby yet: " + lastArg.inspect());
args = Arrays.copyOf(args, args.length - 1);
}
args = dropLastArgIfOptions(runtime, args);
if (! Platform.IS_WINDOWS && args[args.length -1].asJavaString().matches(".*[^&]&\\s*")) {
// looks like we need to send process to the background
ShellLauncher.runWithoutWait(runtime, args);
@@ -1599,7 +1595,18 @@ private static int systemCommon(ThreadContext context, IRubyObject recv, IRubyOb

// RubyStatus uses real native status now, so we unshift Java's shifted exit status
context.setLastExitStatus(RubyProcess.RubyStatus.newProcessStatus(runtime, tuple[0] << 8, tuple[1]));
return (int)tuple[0];
return (int) tuple[0];
}

private static IRubyObject[] dropLastArgIfOptions(final Ruby runtime, final IRubyObject[] args) {
IRubyObject lastArg = args[args.length - 1];
if (lastArg instanceof RubyHash) {
if (!((RubyHash) lastArg).isEmpty()) {
runtime.getWarnings().warn(ID.UNSUPPORTED_SUBPROCESS_OPTION, "system does not support options in JRuby yet: " + lastArg);
}
return Arrays.copyOf(args, args.length - 1);
}
return args;
}

public static IRubyObject exec(ThreadContext context, IRubyObject recv, IRubyObject[] args) {
24 changes: 19 additions & 5 deletions core/src/main/java/org/jruby/util/io/PopenExecutor.java
Original file line number Diff line number Diff line change
@@ -17,6 +17,7 @@
import org.jruby.RubyProcess;
import org.jruby.RubyString;
import org.jruby.RubySymbol;
import org.jruby.common.IRubyWarnings;
import org.jruby.platform.Platform;
import org.jruby.runtime.Arity;
import org.jruby.runtime.Block;
@@ -364,9 +365,23 @@ static IRubyObject handleOptionsCommon(ThreadContext context, Ruby runtime, Exec

if (execargAddopt(context, runtime, eargp, key, val) != ST_CONTINUE) {
if (raise) {
if (key instanceof RubySymbol)
throw runtime.newArgumentError("wrong exec option symbol: " + key);
throw runtime.newArgumentError("wrong exec option");
if (key instanceof RubySymbol) {
switch (key.toString()) {
case "gid" :
//runtime.getWarnings().warn(IRubyWarnings.ID.UNSUPPORTED_SUBPROCESS_OPTION, "popen does not support :gid option in JRuby");
//break;
throw runtime.newNotImplementedError("popen does not support :gid option in JRuby");
case "uid" :
//runtime.getWarnings().warn(IRubyWarnings.ID.UNSUPPORTED_SUBPROCESS_OPTION, "popen does not support :uid option in JRuby");
//break;
throw runtime.newNotImplementedError("popen does not support :uid option in JRuby");
default :
throw runtime.newArgumentError("wrong exec option symbol: " + key);
}
}
else {
throw runtime.newArgumentError("wrong exec option");
}
}

if (nonopts == null) nonopts = RubyHash.newHash(runtime);
@@ -1880,8 +1895,7 @@ else if (progByteList.get(p) == '/'){

if (!eargp.use_shell && eargp.argv_buf == null) {
int i;
List<byte[]> argv_buf;
argv_buf = new ArrayList();
ArrayList<byte[]> argv_buf = new ArrayList<>(argc);
for (i = 0; i < argc; i++) {
IRubyObject arg = argv[i];
RubyString argStr = StringSupport.checkEmbeddedNulls(runtime, arg);
6 changes: 2 additions & 4 deletions pom.rb
Original file line number Diff line number Diff line change
@@ -119,9 +119,7 @@
plugin :clean, '2.5'
plugin :dependency, '2.8'
plugin :release, '2.4.1'
plugin :jar, '2.4' do
jar 'org.codehaus.plexus:plexus-io:2.0.5'
end
plugin :jar, '2.6'

rules = { :requireMavenVersion => { :version => '[3.3.0,)' } }
unless model.version =~ /-SNAPSHOT/
@@ -131,7 +129,7 @@
execute_goal :enforce, :rules => rules
end

plugin :compiler, '3.1'
plugin :compiler, '3.3'
plugin :shade, '2.4.3'
plugin :surefire, '2.15'
plugin :plugin, '3.2'
11 changes: 2 additions & 9 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -259,14 +259,7 @@ DO NOT MODIFIY - GENERATED CODE
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>2.4</version>
<dependencies>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-io</artifactId>
<version>2.0.5</version>
</dependency>
</dependencies>
<version>2.6</version>
</plugin>
<plugin>
<artifactId>maven-enforcer-plugin</artifactId>
@@ -288,7 +281,7 @@ DO NOT MODIFIY - GENERATED CODE
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<version>3.3</version>
</plugin>
<plugin>
<artifactId>maven-shade-plugin</artifactId>
14 changes: 7 additions & 7 deletions test/mri/excludes/TestProcess.rb
Original file line number Diff line number Diff line change
@@ -18,22 +18,22 @@
exclude :test_execopts_env_popen_vector, "needs investigation"
exclude :test_execopts_env_single_word, "Errno::ENOENT: No such file or directory - test_execopts_env_single_word.out"
exclude :test_execopts_exec, "TypeError: wrong exec option: #<IO:<STDOUT>>"
exclude :test_execopts_gid, "#<ArgumentError: wrong exec option symbol: gid>"
exclude :test_execopts_open_chdir, "sh: 1: cd: can't cd to foo"
#exclude :test_execopts_gid, "doesn't really pass but test seems OK due throwing NotImplementedError"
exclude :test_execopts_open_chdir, "needs investigation"
exclude :test_execopts_pgroup, "#<TypeError: no implicit conversion of false into Integer>"
exclude :test_execopts_popen, "needs investigation"
exclude :test_execopts_preserve_env_on_exec_failure, "needs investigation"
exclude :test_execopts_redirect_fd, "Errno::ENOENT: No such file or directory - out"
exclude :test_execopts_redirect_dup2_child, "Errno::ENOENT: No such file or directory - out"
exclude :test_execopts_redirect_nonascii_path, "needs investigation"
exclude :test_execopts_redirect_pipe, "Java::JavaLang::ArrayIndexOutOfBoundsException: -11"
exclude :test_execopts_redirect_pipe, "hangs"
exclude :test_execopts_redirect_symbol, "Errno::ENOENT: No such file or directory - out"
exclude :test_execopts_redirect_to_out_and_err, "out of memory error"
exclude :test_execopts_uid, "needs investigation"
exclude :test_execopts_redirect_to_out_and_err, "Errno::ENOENT: No such file or directory - foo"
#exclude :test_execopts_uid, "doesn't really pass but test seems OK due throwing NotImplementedError"
exclude :test_execopts_umask, "unsupported"
exclude :test_execopts_unsetenv_others, "unsupported"
exclude :test_fallback_to_sh, "needs investigation"
exclude :test_fd_inheritance, "needs investigation"
exclude :test_fallback_to_sh, "Errno::ENOENT: No such file or directory - tmp_script.24694"
exclude :test_fd_inheritance, "unimplemented: cyclic redirects in child are not supported"
exclude :test_gid_re_exchangeable_p, "unimplemented"
exclude :test_gid_sid_available?, "unimplemented"
exclude :test_no_curdir, "won't work due changed wd detection (since 1e30600bdbbf483a)"