still problems with exec() in jdk16
Michiel Boland
michiel at boland.org
Sat Sep 1 04:11:28 PDT 2007
Hi. Sorry to be a bore, but there are still problems with exec() in the
current java/jdk16 port. I noticed this after the subversion module
in netbeans broke. I narrowed it down to the following.
import java.io.IOException;
public class ExecTest {
public static void main(String[] args) throws IOException,
InterruptedException {
Process p = Runtime.getRuntime().exec("ls", new String[] { } );
int exitcode = p.waitFor();
System.out.println("exitcode = " + exitcode);
}
}
This program, when run with the jdk16 java will generate a hot spot error.
Stack trace from hs_err_pid*.log:
C [libc.so.7+0xc6d30] strcmp+0x60
C [libjava.so+0x20317] Java_java_lang_UNIXProcess_forkAndExec+0x367
The only reference to strcmp in UNIXProcess_md.c that makes sense here is
in execvpe
/* Parent and child PATH the same? Use child PATH. */
|| (strcmp(parentPath, effectivePath()) == 0)
It appears that parentPath is 0. The only way that could happen is that
Java_java_lang_UNIXProcess_initIDs is never called.
I believe the following patch needs to be made to UNIXProcess.java.bsd.
(In effect, UNIXProcess.java.bsd should be identical to
UNIXProcess.java.linux.)
--- UNIXProcess.java.bsd.orig 2007-08-31 20:43:03.000000000 +0200
+++ UNIXProcess.java.bsd 2007-08-31 21:24:40.000000000 +0200
@@ -195,4 +195,10 @@
}
}
+ /* This routine initializes JNI field offsets for the class */
+ private static native void initIDs();
+
+ static {
+ initIDs();
+ }
}
More information about the freebsd-java
mailing list