From owner-freebsd-java@FreeBSD.ORG Fri Aug 12 12:01:01 2011 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 DB2531065672; Fri, 12 Aug 2011 12:01:01 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (mx0.zoral.com.ua [91.193.166.200]) by mx1.freebsd.org (Postfix) with ESMTP id 76DF28FC16; Fri, 12 Aug 2011 12:01:01 +0000 (UTC) Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id p7CBb4fx057753 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 12 Aug 2011 14:37:04 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.4/8.14.4) with ESMTP id p7CBb4Sq017865; Fri, 12 Aug 2011 14:37:04 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.4/8.14.4/Submit) id p7CBb4oQ017864; Fri, 12 Aug 2011 14:37:04 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Fri, 12 Aug 2011 14:37:04 +0300 From: Kostik Belousov To: bf1783@gmail.com Message-ID: <20110812113704.GO17489@deviant.kiev.zoral.com.ua> References: Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="TIpgJVE/z+6z946i" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: clamav-milter 0.95.2 at skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-3.3 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00, DNS_FROM_OPENWHOIS autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua Cc: glewis@freebsd.org, tinderbox-list@marcuscom.com, des@freebsd.org, freebsd-java@freebsd.org Subject: Re: java + procfs + nullfs = disaster 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: Fri, 12 Aug 2011 12:01:01 -0000 --TIpgJVE/z+6z946i Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Aug 11, 2011 at 03:18:38PM -0400, b. f. wrote: > I've run into a problem building java ports on my FreeBSD 9 amd64 > tinderbox. Following an earlier suggestion, >=20 > http://www.marcuscom.com/pipermail/tinderbox-list/2010-September/001957.h= tml >=20 > I've been performing builds in a tmpfs that is nullfs-mounted on a ufs > mountpoint. After building packages for java/diablo-jdk16 on > {7.3,8.1}-{i386,amd64}, the ports that depend upon it fail when > invoking java binary executables from that port, with: >=20 > Error: could not find libjava.so > Error: could not find Java 2 Runtime Environment. >=20 > A search of the mailing lists reveals that this problem has occurred > for the past several years, and has sometimes been attributed to the > fact that a procfs is mounted on /proc, and sometimes to vague nullfs > problems, but has never been solved: >=20 > http://lists.freebsd.org/pipermail/freebsd-java/2011-March/009169.html > http://lists.freebsd.org/pipermail/freebsd-stable/2010-May/056814.html > http://lists.freebsd.org/pipermail/freebsd-java/2009-May/008104.html > http://lists.freebsd.org/pipermail/freebsd-java/2009-February/007854.html > http://lists.freebsd.org/pipermail/freebsd-stable/2005-February/011629.ht= ml > ... >=20 > However, it seems rather to be a combination of factors, because, for > example, if I: >=20 > mount /proc > mkdir /tmp/java > tar -C /tmp/java -xvf > /home/shared/freebsd/tinderbox/packages/8.1-amd64-u1/All/diablo-jdk-1.6.0= .07.02_15.tbz > cd /tmp/diablo-jdk1.6.0/bin > truss ./java -version >=20 > , I obtain: >=20 > ... >=20 > readlink("/proc/curproc/file","/tmp/java/diablo-jdk1.6.0/bin/java",1024) > =3D 35 (0x23) > access("/tmp/java/diablo-jdk1.6.0/lib/amd64/libjava.so",0) ERR#2 'No > such file or directory' > access("/tmp/java/diablo-jdk1.6.0/jre/lib/amd64/libjava.so",0) =3D 0 (0x0) >=20 > ... >=20 > , and libjava.so is found. Then, if I: >=20 > umount /proc > truss ./java -version >=20 > , the library is also found, in a slightly different manner: >=20 > +readlink("/proc/curproc/file",0x7fffffffca40,1024) ERR#2 'No such > file or directory' > +__getcwd("/tmp/java/diablo-jdk1.6.0/bin",1026) =3D 0 (0x0) > +stat("/tmp/java/diablo-jdk1.6.0/bin/./java",{ mode=3D-rwxr-xr-x > ,inode=3D3121,size=3D95014,blksize=3D4096 }) =3D 0 (0x0) > +lstat("/tmp",{ mode=3Ddrwxrwxrwt ,inode=3D2,size=3D600,blksize=3D4096 })= =3D 0 (0x0) > +lstat("/tmp/java",{ mode=3Ddrwxr-xr-x ,inode=3D15,size=3D280,blksize=3D4= 096 > }) =3D 0 (0x0) > +lstat("/tmp/java/diablo-jdk1.6.0",{ mode=3Ddrwxr-xr-x > ,inode=3D3105,size=3D560,blksize=3D4096 }) =3D 0 (0x0) > +lstat("/tmp/java/diablo-jdk1.6.0/bin",{ mode=3Ddrwxr-xr-x > ,inode=3D3112,size=3D1720,blksize=3D4096 }) =3D 0 (0x0) > +lstat("/tmp/java/diablo-jdk1.6.0/bin/java",{ mode=3D-rwxr-xr-x > ,inode=3D3121,size=3D95014,blksize=3D4096 }) =3D 0 (0x0) > access("/tmp/java/diablo-jdk1.6.0/lib/amd64/libjava.so",0) ERR#2 'No > such file or directory' > access("/tmp/java/diablo-jdk1.6.0/jre/lib/amd64/libjava.so",0) =3D 0 (0x= 0) >=20 >=20 > However, if I: >=20 > rm -vr /tmp/java > mount /proc > mkdir /tmp/java /root/java > mount -t nullfs /tmp/java /root/java > tar -C /root/java -xvf > /home/shared/freebsd/tinderbox/packages/8.1-amd64-u1/All/diablo-jdk-1.6.0= .07.02_15.tbz > cd /root/diablo-jdk1.6.0/bin > truss ./java -version >=20 > then the library cannot be found: >=20 > readlink("/proc/curproc/file","unknown",1024) =3D 7 (0x7) > Error: could not find libjava.so > write(2,"Error: could not find libjava.so"...,33) =3D 33 (0x21) > Error: could not find Java 2 Runtime Environment. > write(2,"Error: could not find Java 2 Run"...,50) =3D 50 (0x32) This is a long-standing strangeness in our procfs. I wonder how much will break after the following. Can you try ls -l /proc// in the situation when file previously shown 'unknown' ? diff --git a/sys/fs/procfs/procfs.c b/sys/fs/procfs/procfs.c index 8b69eb1..514e279 100644 --- a/sys/fs/procfs/procfs.c +++ b/sys/fs/procfs/procfs.c @@ -67,20 +67,23 @@ int procfs_doprocfile(PFS_FILL_ARGS) { - char *fullpath =3D "unknown"; - char *freepath =3D NULL; + char *fullpath; + char *freepath; struct vnode *textvp; + int error; =20 + freepath =3D NULL; PROC_LOCK(p); textvp =3D p->p_textvp; vhold(textvp); PROC_UNLOCK(p); - vn_fullpath(td, textvp, &fullpath, &freepath); + error =3D vn_fullpath(td, textvp, &fullpath, &freepath); vdrop(textvp); - sbuf_printf(sb, "%s", fullpath); - if (freepath) + if (error =3D=3D 0) + sbuf_printf(sb, "%s", fullpath); + if (freepath !=3D NULL) free(freepath, M_TEMP); - return (0); + return (error); } =20 /* --TIpgJVE/z+6z946i Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (FreeBSD) iEYEARECAAYFAk5FEF8ACgkQC3+MBN1Mb4g7EwCfZTd4P7AOIod3yU9HkmLczMuh ongAoKi86yVAdEVzEpR0T11YDHKb0uOu =ZkGy -----END PGP SIGNATURE----- --TIpgJVE/z+6z946i--