Date: Sat, 1 Sep 2007 13:11:11 +0200 (MEST) From: Michiel Boland <michiel@boland.org> To: freebsd-java@freebsd.org Subject: still problems with exec() in jdk16 Message-ID: <Pine.GSO.4.64.0709011258540.2943@neerbosch.nijmegen.internl.net>
next in thread | raw e-mail | index | archive | help
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(); + } }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.GSO.4.64.0709011258540.2943>