From owner-freebsd-stable@FreeBSD.ORG Sun Sep 8 11:04:00 2013 Return-Path: Delivered-To: stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id C5391842; Sun, 8 Sep 2013 11:04:00 +0000 (UTC) (envelope-from baptiste.daroussin@gmail.com) Received: from mail-we0-x22f.google.com (mail-we0-x22f.google.com [IPv6:2a00:1450:400c:c03::22f]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id D92B7280F; Sun, 8 Sep 2013 11:03:59 +0000 (UTC) Received: by mail-we0-f175.google.com with SMTP id q59so4338246wes.20 for ; Sun, 08 Sep 2013 04:03:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=OfzKnw+ZXLFnMJ6LGxya211QBJy4856luclTo0+CGZk=; b=JhwjLtV+syttFYd9FkdLHtzlm4TGG/9uiBYeITslz6YVerHPSvqGUmA1KZedqFHgQ4 YvJR8ANjKzNn64r78/HkfDt+QyTN8nTyEdQqSktVWlbE3eTrBF4sqZjQm1TSqwmlMywP 6OS+nIDuEjAHCj1cXMa32C4nA7gOYbxkZO4UlXP0TWztwOsCX7uGH6CvSllfwSC715j5 yjys3gekukAhJBn19+0dTIuuHHvaJcsgXTCUo4QvP2+YNzq1QJGV0arjEtCa7mmIKydK /hmvGH7mytA4f8gLpzfm/kr+z8cPl3favF/VVYm8XXYe5ZaxEdNMCnWp/UVtpusPPJxS vyWg== X-Received: by 10.180.105.226 with SMTP id gp2mr4773257wib.6.1378638238323; Sun, 08 Sep 2013 04:03:58 -0700 (PDT) Received: from ithaqua.etoilebsd.net (ithaqua.etoilebsd.net. [37.59.37.188]) by mx.google.com with ESMTPSA id a8sm9581395wie.6.1969.12.31.16.00.00 (version=TLSv1 cipher=RC4-SHA bits=128/128); Sun, 08 Sep 2013 04:03:57 -0700 (PDT) Sender: Baptiste Daroussin Date: Sun, 8 Sep 2013 13:03:55 +0200 From: Baptiste Daroussin To: Maxim Sobolev Subject: Re: Troubles with dependencies (file -L is broken?) Message-ID: <20130908110354.GJ77141@ithaqua.etoilebsd.net> References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="fKov5AqTsvseSZ0Z" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Cc: ports@freebsd.org, stable@freebsd.org, portmgr@freebsd.org X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Sep 2013 11:04:00 -0000 --fKov5AqTsvseSZ0Z Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Sep 08, 2013 at 12:09:32AM -0700, Maxim Sobolev wrote: > Hi, >=20 > I am trying to portupgrade my subversion and it keeps trying to install > databases/db42 over already installed version (same version), missing the > shared library dependency. >=20 > Adding some debug into bsd.port.mk, I see: >=20 > =3D=3D=3D> subversion-1.8.3 depends on package: libtool>=3D2.4 - found > set -x; set -e ; for i in libdb-4.2.so:/usr/ports/databases/db42; do > lib=3D${i%%:*} ; dir=3D${i#*:} ; target=3D"install"; depends_args=3D"= "; echo > -n "=3D=3D=3D> subversion-1.8.3 depends on shared library: ${lib}" ; f= ound=3D0 > ; dirs=3D"/lib /usr/lib /usr/local/lib `/bin/cat > /usr/local/libdata/ldconfig/* 2>/dev/null || : `" ; for libdir in $dirs; > do test -f ${libdir}/${lib} || continue; if [ -x /usr/bin/file ]; then = [ > `file -b -L --mime-type ${libdir}/${lib}` =3D "application/x-sharedlib" ]= || > continue ; fi ; found=3D1 ; echo " - found"; done ; if [ ${found} -e= q 0 > ]; then echo " - not found"; echo "=3D=3D=3D> Verifying for $lib in = $dir"; > if [ ! -d "$dir" ] ; then echo " =3D> No directory for $lib. > Skipping.."; else if [ -n "" -o -n "" ]; then subpkgfile=3D`(cd $dir; = make > $depends_args -V PKGFILE)`; subpkgname=3D${subpkgfile%-*} ; > subpkgname=3D${subpkgname##*/} ; if [ -r "${subpkgfile}" -a "$target" =3D > "install" ]; then echo "=3D=3D=3D> Installing existing package > ${subpkgfile}"; if [ -n "" -a ${subpkgname} =3D "pkg" ]; then [ -d > /usr/ports/devel/subversion/work ] || /bin/mkdir -p > /usr/ports/devel/subversion/work ; /usr/bin/tar xf ${subpkgfile} -C > /usr/ports/devel/subversion/work -s ",/.*/,,g" "*/pkg-static" ; > /usr/ports/devel/subversion/work/pkg-static add ${subpkgfile}; /bin/rm -f > /usr/ports/devel/subversion/work/pkg-static; else /usr/sbin/pkg_add > ${subpkgfile}; fi; elif [ -n "" -a "${target}" =3D "install" ]; then e= cho > "=3D=3D=3D> subversion-1.8.3 depends on package: ${subpkgfile} - not fo= und"; > echo "=3D=3D=3D> USE_PACKAGE_DEPENDS_ONLY set - will not build from sou= rce"; > exit 1; else (cd $dir; make -DINSTALLS_DEPENDS $target $depends_args) ; > fi; else (cd $dir; make -DINSTALLS_DEPENDS $target $depends_args) ; fi; > echo "=3D=3D=3D> Returning to build of subversion-1.8.3"; fi ; fi ; = done > + set -e > + lib=3Dlibdb-4.2.so > + dir=3D/usr/ports/databases/db42 > + target=3Dinstall > + depends_args=3D'' > + echo -n '=3D=3D=3D> subversion-1.8.3 depends on shared library: libdb= -4.2.so' > =3D=3D=3D> subversion-1.8.3 depends on shared library: libdb-4.2.so+ fo= und=3D0 > + /bin/cat /usr/local/libdata/ldconfig/compat7x > /usr/local/libdata/ldconfig/mysql /usr/local/libdata/ldconfig/portupgrade > /usr/local/libdata/ldconfig/pth > + dirs=3D'/lib /usr/lib /usr/local/lib /usr/local/lib/compat > /usr/local/lib/mysql > /usr/local/lib/compat/pkg > /usr/local/lib/pth' > + test -f /lib/libdb-4.2.so > + continue > + test -f /usr/lib/libdb-4.2.so > + continue > + test -f /usr/local/lib/libdb-4.2.so > + [ -x /usr/bin/file ] > + file -b -L --mime-type /usr/local/lib/libdb-4.2.so > + [ inode/symlink =3D application/x-sharedlib ] > + continue > + test -f /usr/local/lib/compat/libdb-4.2.so > + continue > + test -f /usr/local/lib/mysql/libdb-4.2.so > + continue > + test -f /usr/local/lib/compat/pkg/libdb-4.2.so > + continue > + test -f /usr/local/lib/pth/libdb-4.2.so > + continue > + [ 0 -eq 0 ] > + echo ' - not found' > - not found > + echo '=3D=3D=3D> Verifying for libdb-4.2.so in /usr/ports/databases/= db42' > =3D=3D=3D> Verifying for libdb-4.2.so in /usr/ports/databases/db42 >=20 > So, file(1) call is the culprit here. Trying to reproduce in the console: >=20 > [sobomax@pioneer ~]$ file -b -L --mime-type /usr/local/lib/libdb-4.2.so > inode/symlink >=20 > However: >=20 > [sobomax@pioneer ~]$ hexdump -C /usr/local/lib/libdb-4.2.so | head -n 20 > 00000000 7f 45 4c 46 02 01 01 09 00 00 00 00 00 00 00 00 > |.ELF............| > 00000010 03 00 3e 00 01 00 00 00 d0 40 02 00 00 00 00 00 > |..>.....=D0=BF@......| > 00000020 40 00 00 00 00 00 00 00 b8 a6 0e 00 00 00 00 00 > |@.......=E2=95=A6=D1=96......| > 00000030 00 00 00 00 40 00 38 00 05 00 40 00 1d 00 1a 00 |....@.8...@ > .....| > 00000040 01 00 00 00 05 00 00 00 00 00 00 00 00 00 00 00 > |................| > 00000050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 > |................| > 00000060 dc 45 0e 00 00 00 00 00 dc 45 0e 00 00 00 00 00 > |=D1=8DE......=D1=8DE......| > 00000070 00 00 20 00 00 00 00 00 01 00 00 00 06 00 00 00 |.. > .............| > 00000080 00 50 0e 00 00 00 00 00 00 50 2e 00 00 00 00 00 > |.P.......P......| > 00000090 00 50 2e 00 00 00 00 00 fc 36 00 00 00 00 00 00 > |.P......=D0=AD6......| > 000000a0 d8 3a 00 00 00 00 00 00 00 00 20 00 00 00 00 00 |=D1=8C:.....= =2E.. > .....| > 000000b0 02 00 00 00 06 00 00 00 e8 54 0e 00 00 00 00 00 > |........=D0=A5T......| > 000000c0 e8 54 2e 00 00 00 00 00 e8 54 2e 00 00 00 00 00 > |=D0=A5T......=D0=A5T......| > 000000d0 a0 01 00 00 00 00 00 00 a0 01 00 00 00 00 00 00 > |=E2=95=90.......=E2=95=90.......| > 000000e0 08 00 00 00 00 00 00 00 50 e5 74 64 04 00 00 00 > |........P=D0=95td....| > 000000f0 5c 39 0d 00 00 00 00 00 5c 39 0d 00 00 00 00 00 > |\9......\9......| > 00000100 5c 39 0d 00 00 00 00 00 b4 34 00 00 00 00 00 00 > |\9......=D0=844......| > 00000110 b4 34 00 00 00 00 00 00 04 00 00 00 00 00 00 00 > |=D0=844..............| >=20 > The culprit is that /usr/local/lib/libdb-4.2.so is a symlink to another > symlink to another symlink etc, so that my guess is that file(1) stops at > the first one. The issue can be resolved by using realpath(1), attached > patch fixes it for me. >=20 > [sobomax@pioneer ~]$ realpath /usr/local/lib/libdb-4.2.so > /usr/local/lib/db42/libdb-4.2.so.2 > [sobomax@pioneer ~]$ file -b -L --mime-type > /usr/local/lib/db42/libdb-4.2.so.2 > application/x-sharedlib > [sobomax@pioneer ~]$ ls -l /usr/local/lib/libdb-4.2.so > lrwxr-xr-x 1 root wheel 14 7 =D1=81=D0=B5=D0=BD 21:43 /usr/local/lib/= libdb-4.2.so -> > libdb-4.2.so.2 >=20 > I am not sure what's the process to get bsd.port.mk adjusted these days. > Should I open a PR and assign it to portmgr? The problem is file -L is resolving only one level of symlinks. Yes that is usually still the process, but given I got time right now to te= st it, please just commit :) Approved by: portmgr (bapt) regards, Bapt --fKov5AqTsvseSZ0Z Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (FreeBSD) iEYEARECAAYFAlIsWZoACgkQ8kTtMUmk6EwCzgCguoQ+/9s4AFMUjZ34ngi382vJ 8AgAn1bSOu3PD8qj00/wMPSjV5Oi3SeD =/IXW -----END PGP SIGNATURE----- --fKov5AqTsvseSZ0Z--