From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from caine.easynet.fr (smarthost161.mail.easynet.fr [212.180.1.161]) by robin.gentoo.org (8.13.4/8.13.4) with ESMTP id j3NCLEeW025718 for ; Sat, 23 Apr 2005 12:21:14 GMT Received: from easyconnect2121138-64.clients.easynet.fr ([212.11.38.64] helo=eusebe) by caine.easynet.fr with esmtp (Exim 4.34) id 1DPJdQ-0006S5-P3 for gentoo-dev@lists.gentoo.org; Sat, 23 Apr 2005 14:21:20 +0200 Date: Sat, 23 Apr 2005 14:21:04 +0200 From: Thomas de Grenier de Latour To: gentoo-dev@lists.gentoo.org Subject: Re: [gentoo-dev] Reverse dependency Scanning Message-ID: <20050423142104.47c8494b@eusebe> In-Reply-To: <1114251333.619.9.camel@Darkmere> References: <1114251333.619.9.camel@Darkmere> Organization: Fasmz X-Mailer: Sylpheed-Claws 1.0.0cvs21.1 (GTK+ 2.6.7; i686-pc-linux-gnu) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-dev@gentoo.org Reply-to: gentoo-dev@lists.gentoo.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="Multipart_Sat__23_Apr_2005_14_21_04_+0200_=cYAnEZofRio4.sS" X-Archives-Salt: b1d4c728-dc93-4ea5-ba3b-7cf3221ea312 X-Archives-Hash: a9036b3526b237ed7e36b6fa611cd778 --Multipart_Sat__23_Apr_2005_14_21_04_+0200_=cYAnEZofRio4.sS Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Disposition: inline On Sat, 23 Apr 2005 12:15:32 +0200 Spider wrote: > So, I know it isn't foolproof, don't expect it to be. However, > feedback would be nice, patches and so on. I think that for binaries you could filter the ldd output to keep only the libs that are directly linked to, since that's what should really become dependencies. See atttached patch for a possible quick and dirty implementation. Example without the patch: % echo /usr/games/bin/abuse.sdl | ./depreverse.orig /lib/libdl.so.2 /lib/libncursesw.so.5 /lib/libnsl.so.1 /lib/tls/libc.so.6 /lib/tls/libm.so.6 /lib/tls/libpthread.so.0 /usr/lib/gcc/i686-pc-linux-gnu/3.4.3-20050110/libgcc_s.so.1 /usr/lib/gcc/i686-pc-linux-gnu/3.4.3-20050110/libstdc++.so.6 /usr/lib/libaa.so.1 /usr/lib/libcaca.so.0 /usr/lib/libSDL-1.2.so.0 /usr/lib/libslang-utf8.so.1 /usr/lib/libvga.so.1 /usr/lib/libX11.so.6 /usr/lib/libXext.so.6 /usr/lib/libXxf86vm.so.1 /usr/lib/opengl/xorg-x11/lib/libGL.so.1 The same with the patch: % echo /usr/games/bin/abuse.sdl | ./depreverse /lib/libnsl.so.1 /lib/tls/libc.so.6 /lib/tls/libm.so.6 /lib/tls/libpthread.so.0 /usr/lib/gcc/i686-pc-linux-gnu/3.4.3-20050110/libgcc_s.so.1 /usr/lib/gcc/i686-pc-linux-gnu/3.4.3-20050110/libstdc++.so.6 /usr/lib/libSDL-1.2.so.0 /usr/lib/opengl/xorg-x11/lib/libGL.so.1 -- TGL. --Multipart_Sat__23_Apr_2005_14_21_04_+0200_=cYAnEZofRio4.sS Content-Type: text/x-patch; name=depreverse--filter_libs.patch Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=depreverse--filter_libs.patch --- depreverse.orig 2005-04-23 13:35:49.000000000 +0200 +++ depreverse 2005-04-23 14:03:07.000000000 +0200 @@ -111,7 +111,8 @@ # since we already tested if executables are executable, we only need one pass to test both theese lists. for FILE in $EXELIST $LIBLIST ; do if [ -r $FILE ]; then - ldd $FILE |grep -v 'libNoVersion.so' | grep -v 'linux-gate.so' | awk '/=>/ { print $3 }' + needed_libs_regexp="$(objdump -p $FILE | awk '/NEEDED/ { rex=rex "\\|\\<"$2"\\>"} ; END {print substr(rex,3)}')" + ldd $FILE | grep "${needed_libs_regexp}" | awk '/=>/ { print $3 }' fi done | sort -u | sed "s/['\"]/\\\&/g" | sort -u --Multipart_Sat__23_Apr_2005_14_21_04_+0200_=cYAnEZofRio4.sS-- -- gentoo-dev@gentoo.org mailing list