Date: Fri, 18 May 2007 18:04:56 -0400 From: Kris Kennaway <kris@obsecurity.org> To: Peter Jeremy <peterjeremy@optushome.com.au> Cc: ports@freebsd.org Subject: Re: Specs for saving old shared libs Message-ID: <20070518220456.GA52494@xor.obsecurity.org> In-Reply-To: <20070518214729.GA29623@turion.vk2pj.dyndns.org> References: <20070507201448.GA52651@xor.obsecurity.org> <op.try4tyhd9aq2h7@mezz.mezzweb.com> <20070507204414.GA53358@xor.obsecurity.org> <20070507205850.GA34916@lor.one-eyed-alien.net> <20070507220659.GC78665@graf.pompo.net> <20070507222146.GA57768@xor.obsecurity.org> <464CB5AA.7040304@FreeBSD.org> <1179437517.8912.5.camel@ikaros.oook.cz> <20070518075058.GB1164@turion.vk2pj.dyndns.org> <20070518214729.GA29623@turion.vk2pj.dyndns.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, May 19, 2007 at 07:47:30AM +1000, Peter Jeremy wrote: > On 2007-May-18 17:50:58 +1000, Peter Jeremy <peter@turion.vk2pj.dyndns.org> wrote: > >Ideally, you also need some way to identify (and remove) old .so files > >that are no longer referenced by anything. This is not as easy > >because there's no record of what ports use what .so's (and no way to > >track apps outside the ports system). > > OK, my offering to assist with this scans a specified set of file > trees and reports any executables that reference shared libraries in > compat or that can't be found: > > #!/bin/sh > # > # Find executables using compat libraries > > find -x "$@" -type f -perm +0100 -print0 |\ > ( xargs -0 ldd 2>&1 >&3 | \ > egrep -v "not a dynamic executable|can't read program header|Exec format error" >&2 ) 3>&1 |\ > awk '/^[^ ]/ { exe = $0; next } > NF != 4 || $3 ~ /\/compat\// || $4 !~ /^\(0x[0-9a-f]*[1-9a-f]/ { print exe, $0}' For portupgrade users there is the libchk port which also looks for references to libraries that are not installed. Unfortunately thesedays there are a lot of false positives on typical installations because lots of ports set a non-default library search path at runtime. Kris
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20070518220456.GA52494>