From owner-freebsd-java@FreeBSD.ORG Sat Sep 1 11:11:28 2007 Return-Path: Delivered-To: freebsd-java@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 10C7B16A417 for ; Sat, 1 Sep 2007 11:11:28 +0000 (UTC) (envelope-from michiel@boland.org) Received: from neerbosch.nijmegen.internl.net (neerbosch.nijmegen.internl.net [217.149.193.38]) by mx1.freebsd.org (Postfix) with ESMTP id A11E913C47E for ; Sat, 1 Sep 2007 11:11:27 +0000 (UTC) (envelope-from michiel@boland.org) Received: from neerbosch.nijmegen.internl.net by neerbosch.nijmegen.internl.net via neerbosch.nijmegen.internl.net [217.149.193.38] with ESMTP for id l81BBDcH004484 (8.13.4/1.4); Sat, 1 Sep 2007 13:11:13 +0200 (MEST) Received: from localhost by neerbosch.nijmegen.internl.net via mboland@localhost with ESMTP for id l81BBDvI004481 (8.13.4/2.02); Sat, 1 Sep 2007 13:11:13 +0200 (MEST) X-Authentication-Warning: neerbosch.nijmegen.internl.net: mboland owned process doing -bs Date: Sat, 1 Sep 2007 13:11:11 +0200 (MEST) From: Michiel Boland To: freebsd-java@freebsd.org Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Subject: still problems with exec() in jdk16 X-BeenThere: freebsd-java@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting Java to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Sep 2007 11:11:28 -0000 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(); + } }