Date: Sun, 8 Sep 2013 13:03:55 +0200 From: Baptiste Daroussin <bapt@FreeBSD.org> To: Maxim Sobolev <sobomax@FreeBSD.org> Cc: ports@freebsd.org, stable@freebsd.org, portmgr@freebsd.org Subject: Re: Troubles with dependencies (file -L is broken?) Message-ID: <20130908110354.GJ77141@ithaqua.etoilebsd.net> In-Reply-To: <CAH7qZfusr5khx_QHbjKa6GLmGK%2B8=n=u9Fo8AyVxcT63sE2nyg@mail.gmail.com> References: <CAH7qZfusr5khx_QHbjKa6GLmGK%2B8=n=u9Fo8AyVxcT63sE2nyg@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
--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--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20130908110354.GJ77141>