From jon@FreeBSD.org  Tue Aug 18 20:31:47 2009
Return-Path: <jon@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 930CD1065690
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 18 Aug 2009 20:31:47 +0000 (UTC)
	(envelope-from jon@FreeBSD.org)
Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28])
	by mx1.freebsd.org (Postfix) with ESMTP id 807FE8FC41
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 18 Aug 2009 20:31:47 +0000 (UTC)
Received: from freefall.freebsd.org (jon@localhost [127.0.0.1])
	by freefall.freebsd.org (8.14.3/8.14.3) with ESMTP id n7IKVls1080019
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 18 Aug 2009 20:31:47 GMT
	(envelope-from jon@freefall.freebsd.org)
Received: (from jon@localhost)
	by freefall.freebsd.org (8.14.3/8.14.3/Submit) id n7IKVlEG080018;
	Tue, 18 Aug 2009 20:31:47 GMT
	(envelope-from jon)
Message-Id: <200908182031.n7IKVlEG080018@freefall.freebsd.org>
Date: Tue, 18 Aug 2009 20:31:47 GMT
From: Jonathan Chen <jon@freebsd.org>
Reply-To: Jonathan Chen <jon@freebsd.org>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: bsd java does not start from nullfs mount when procfs is available
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         137940
>Category:       ports
>Synopsis:       java/jdk15, java/jdk16: bsd java does not start from nullfs mount when procfs is available
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    glewis
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Aug 18 20:40:02 UTC 2009
>Closed-Date:    Mon Dec 17 02:33:22 UTC 2012
>Last-Modified:  Mon Dec 17 02:33:22 UTC 2012
>Originator:     Jonathan Chen
>Release:        FreeBSD 7.2-STABLE i386
>Organization:
>Environment:


>Description:
	When procfs is available, java cannot be started from under nullfs mounts.
	This is due to /proc/currproc/file returning a symlink to "unknown" instead of the java executable.
	This can break java in chroot environments setup with nullfs.
	Problem occurs with jdk15 and jdk16
>How-To-Repeat:
	mount /proc ; mount -t nullfs /usr/local/java /mnt ; /mnt/bin/java
>Fix:
	The following patch allows java to fall back to non-procfs means of finding itself if procfs does not return an absolute path.

--- ../../j2se/src/solaris/bin/java_md.c~	2009-08-18 15:43:01.000000000 -0400
+++ ../../j2se/src/solaris/bin/java_md.c	2009-08-18 15:43:44.000000000 -0400
@@ -905,7 +905,7 @@
 	const char* self = "/proc/curproc/file";
         char buf[PATH_MAX+1];
         int len = readlink(self, buf, PATH_MAX);
-        if (len >= 0) {
+        if (len >= 0 && buf[0] == '/') {
 	    buf[len] = '\0';		/* readlink doesn't nul terminate */
 	    exec_path = strdup(buf);
 	}
--- ../../deploy/src/javaws/solaris/native/system_md.c~	2009-08-18 15:42:54.000000000 -0400
+++ ../../deploy/src/javaws/solaris/native/system_md.c	2009-08-18 15:43:39.000000000 -0400
@@ -408,7 +408,7 @@
         const char* self = "/proc/curproc/file";
         char buf[PATH_MAX+1];
         int len = readlink(self, buf, PATH_MAX);
-        if (len >= 0) {
+        if (len >= 0 && buf[0] == '/') {
             buf[len] = '\0';            /* readlink doesn't nul terminate */
             exec_path = strdup(buf);
         }


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-ports-bugs->glewis 
Responsible-Changed-By: jon 
Responsible-Changed-When: Thu Aug 20 04:24:28 UTC 2009 
Responsible-Changed-Why:  
over to maintainer 

http://www.freebsd.org/cgi/query-pr.cgi?pr=137940 
State-Changed-From-To: open->closed 
State-Changed-By: glewis 
State-Changed-When: Mon Dec 17 02:33:22 UTC 2012 
State-Changed-Why:  
jdk15 and jdk16 have been deprecated 

http://www.freebsd.org/cgi/query-pr.cgi?pr=137940 
>Unformatted:
