Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8197920

ProcessBuilder on MacOS always fails with 'No such file' for 1.8.0_162

XMLWordPrintable

    • x86_64
    • os_x

      FULL PRODUCT VERSION :
      Java(TM) SE Runtime Environment (build 1.8.0_162-b12)
      Java HotSpot(TM) 64-Bit Server VM (build 25.162-b12, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      MacOS Darwin Kernel Version 15.6.0

      A DESCRIPTION OF THE PROBLEM :
      When starting java.lang.ProcesessBuilder with any path on MacOS using JRE 1.8.0_162 it will fail with and IOException with the message 'No such file or directory'.

      It is working as expected for both
      1.8.0_161
      1.8.0_102


      REGRESSION. Last worked in version 8u161

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Run attached code under 1.8.0_162


      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Expected is that ProcessBuilder start /bin/bash and no exception is thrown, as is the case on other JRE versions
      ACTUAL -
      An IOException is thrown

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      The following stacktrace is printed:

      Exception in thread "main" java.io.IOException: Cannot run program "/bin/bash": error=2, No such file or directory
      at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
      at test.Test.main(Test.java:10)
      Caused by: java.io.IOException: error=2, No such file or directory
      at java.lang.UNIXProcess.forkAndExec(Native Method)
      at java.lang.UNIXProcess.<init>(UNIXProcess.java:247)
      at java.lang.ProcessImpl.start(ProcessImpl.java:134)
      at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
      ... 1 more

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      package test;

      import java.io.IOException;

      public class Test {

      public static void main(String[] args) throws IOException {
      ProcessBuilder pb = new ProcessBuilder();
      pb.command("/bin/bash");
      pb.start();
      }

      }

      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      None known to me,

            psonal Pallavi Sonal (Inactive)
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: