Date: Sun, 8 Sep 2013 00:09:32 -0700 From: Maxim Sobolev <sobomax@FreeBSD.org> To: stable@freebsd.org, ports@freebsd.org, portmgr@freebsd.org Subject: Troubles with dependencies (file -L is broken?) Message-ID: <CAH7qZfusr5khx_QHbjKa6GLmGK%2B8=n=u9Fo8AyVxcT63sE2nyg@mail.gmail.com>
next in thread | raw e-mail | index | archive | help
--001a11c33fe60f554c04e5d9f408 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Hi, 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. Adding some debug into bsd.port.mk, I see: =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}" ; fou= nd=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} -eq = 0 ]; then echo " - not found"; echo "=3D=3D=3D> Verifying for $lib in $d= ir"; if [ ! -d "$dir" ] ; then echo " =3D> No directory for $lib. Skipping.."; else if [ -n "" -o -n "" ]; then subpkgfile=3D`(cd $dir; ma= ke $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 ech= o "=3D=3D=3D> subversion-1.8.3 depends on package: ${subpkgfile} - not foun= d"; echo "=3D=3D=3D> USE_PACKAGE_DEPENDS_ONLY set - will not build from sourc= e"; 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 ; do= ne + 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+ foun= d=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/db= 42' =3D=3D=3D> Verifying for libdb-4.2.so in /usr/ports/databases/db42 So, file(1) call is the culprit here. Trying to reproduce in the console: [sobomax@pioneer ~]$ file -b -L --mime-type /usr/local/lib/libdb-4.2.so inode/symlink However: [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:.......= . .....| 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..............| 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. [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/li= bdb-4.2.so -> libdb-4.2.so.2 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? -Maxim --001a11c33fe60f554c04e5d9f408 Content-Type: application/octet-stream; name="bsd.port.mk.diff" Content-Disposition: attachment; filename="bsd.port.mk.diff" Content-Transfer-Encoding: base64 X-Attachment-Id: f_hlbx6h7j0 LS0tIGJzZC5wb3J0Lm1rCTIwMTMvMDkvMDggMDc6MDQ6MjIJMS4xCisrKyBic2QucG9ydC5tawky MDEzLzA5LzA4IDA3OjA2OjAyCkBAIC01MDQ5LDcgKzUwNDksOCBAQAogCQlmb3IgbGliZGlyIGlu ICQkZGlyczsgZG8gXAogCQkJdGVzdCAtZiAkJHtsaWJkaXJ9LyQke2xpYn0gfHwgY29udGludWU7 IFwKIAkJCWlmIFsgLXggL3Vzci9iaW4vZmlsZSBdOyB0aGVuIFwKLQkJCQlbIGBmaWxlIC1iIC1M IC0tbWltZS10eXBlICQke2xpYmRpcn0vJCR7bGlifWAgPSAiYXBwbGljYXRpb24veC1zaGFyZWRs aWIiIF0gfHwgY29udGludWUgOyBcCisJCQkJX0xJQl9GSUxFPWByZWFscGF0aCAkJHtsaWJkaXJ9 LyQke2xpYn1gOyBcCisJCQkJWyBgZmlsZSAtYiAtTCAtLW1pbWUtdHlwZSAkJHtfTElCX0ZJTEV9 YCA9ICJhcHBsaWNhdGlvbi94LXNoYXJlZGxpYiIgXSB8fCBjb250aW51ZSA7IFwKIAkJCWZpIDsg XAogCQkJZm91bmQ9MSA7IFwKIAkJCSR7RUNIT19NU0d9ICIgLSBmb3VuZCI7IFwK --001a11c33fe60f554c04e5d9f408--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAH7qZfusr5khx_QHbjKa6GLmGK%2B8=n=u9Fo8AyVxcT63sE2nyg>