Troubles with dependencies (file -L is broken?)
Baptiste Daroussin
bapt at FreeBSD.org
Sun Sep 8 11:04:00 UTC 2013
On Sun, Sep 08, 2013 at 12:09:32AM -0700, Maxim Sobolev wrote:
> 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:
>
> ===> subversion-1.8.3 depends on package: libtool>=2.4 - found
> set -x; set -e ; for i in libdb-4.2.so:/usr/ports/databases/db42; do
> lib=${i%%:*} ; dir=${i#*:} ; target="install"; depends_args=""; echo
> -n "===> subversion-1.8.3 depends on shared library: ${lib}" ; found=0
> ; dirs="/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}` = "application/x-sharedlib" ] ||
> continue ; fi ; found=1 ; echo " - found"; done ; if [ ${found} -eq 0
> ]; then echo " - not found"; echo "===> Verifying for $lib in $dir";
> if [ ! -d "$dir" ] ; then echo " => No directory for $lib.
> Skipping.."; else if [ -n "" -o -n "" ]; then subpkgfile=`(cd $dir; make
> $depends_args -V PKGFILE)`; subpkgname=${subpkgfile%-*} ;
> subpkgname=${subpkgname##*/} ; if [ -r "${subpkgfile}" -a "$target" =
> "install" ]; then echo "===> Installing existing package
> ${subpkgfile}"; if [ -n "" -a ${subpkgname} = "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}" = "install" ]; then echo
> "===> subversion-1.8.3 depends on package: ${subpkgfile} - not found";
> echo "===> USE_PACKAGE_DEPENDS_ONLY set - will not build from source";
> exit 1; else (cd $dir; make -DINSTALLS_DEPENDS $target $depends_args) ;
> fi; else (cd $dir; make -DINSTALLS_DEPENDS $target $depends_args) ; fi;
> echo "===> Returning to build of subversion-1.8.3"; fi ; fi ; done
> + set -e
> + lib=libdb-4.2.so
> + dir=/usr/ports/databases/db42
> + target=install
> + depends_args=''
> + echo -n '===> subversion-1.8.3 depends on shared library: libdb-4.2.so'
> ===> subversion-1.8.3 depends on shared library: libdb-4.2.so+ found=0
> + /bin/cat /usr/local/libdata/ldconfig/compat7x
> /usr/local/libdata/ldconfig/mysql /usr/local/libdata/ldconfig/portupgrade
> /usr/local/libdata/ldconfig/pth
> + dirs='/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 = 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 '===> Verifying for libdb-4.2.so in /usr/ports/databases/db42'
> ===> 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 at pioneer ~]$ file -b -L --mime-type /usr/local/lib/libdb-4.2.so
> inode/symlink
>
> However:
>
> [sobomax at 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
> |..>.....п@......|
> 00000020 40 00 00 00 00 00 00 00 b8 a6 0e 00 00 00 00 00
> |@.......╦і......|
> 00000030 00 00 00 00 40 00 38 00 05 00 40 00 1d 00 1a 00 |.... at .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
> |эE......эE......|
> 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......Э6......|
> 000000a0 d8 3a 00 00 00 00 00 00 00 00 20 00 00 00 00 00 |ь:........
> .....|
> 000000b0 02 00 00 00 06 00 00 00 e8 54 0e 00 00 00 00 00
> |........ХT......|
> 000000c0 e8 54 2e 00 00 00 00 00 e8 54 2e 00 00 00 00 00
> |ХT......ХT......|
> 000000d0 a0 01 00 00 00 00 00 00 a0 01 00 00 00 00 00 00
> |═.......═.......|
> 000000e0 08 00 00 00 00 00 00 00 50 e5 74 64 04 00 00 00
> |........PЕtd....|
> 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......Є4......|
> 00000110 b4 34 00 00 00 00 00 00 04 00 00 00 00 00 00 00
> |Є4..............|
>
> 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 at pioneer ~]$ realpath /usr/local/lib/libdb-4.2.so
> /usr/local/lib/db42/libdb-4.2.so.2
> [sobomax at pioneer ~]$ file -b -L --mime-type
> /usr/local/lib/db42/libdb-4.2.so.2
> application/x-sharedlib
> [sobomax at pioneer ~]$ ls -l /usr/local/lib/libdb-4.2.so
> lrwxr-xr-x 1 root wheel 14 7 сен 21:43 /usr/local/lib/libdb-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?
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 test it,
please just commit :)
Approved by: portmgr (bapt)
regards,
Bapt
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/freebsd-stable/attachments/20130908/cbdf8705/attachment.sig>
More information about the freebsd-stable
mailing list