How to generate a list of ports dependent upon old /usr/lib/*.so

I want to keep /usr/lib as clean as possible. However the best-practice of recompiling every port whenever a lib is updated seems somewhat excessive and potentially damaging when a new port version might fail without immediate attention upon upgrade.

In order to be able to upgrade more thoughtfully, can someone please suggest a method to list all the currently installed ports linked against an *.so which is NOT the current default .so file?

--
pkg_libchk in sysutils/bsdadminscripts does not immediately appear to be helpful, but I might be misreading the man page.

Thank you for your time.
 
...
In order to be able to upgrade more thoughtfully, can someone please suggest a method to list all the currently installed ports linked against an *.so which is NOT the current default .so file?

I am not 100 % sure whether I understood your objective correctly. If you want to know all ports which are linked against for example libssl.so.7, then on FreeBSD 10.1 you could use the following command:

find /usr/local/bin /usr/local/sbin /usr/local/libexec /usr/local/lib -type f | xargs -n1 file -F ' ' | grep ELF | cut -f1 -d' ' | xargs ldd -f '%A %o\n' | grep "libssl.so.7" | cut -f1 -d' ' | sort -u | xargs -n1 pkg which | cut -f6 -d' ' | sort -u

Be prepared that it will take minutes until the long pipe spills something out.
 
It's not a matter of recompiling every port, just those that depend on the one that changed.

pkg_libchk will identify any port binary that is missing a library, which should find the ones with problems.
 
It's not a matter of recompiling every port, just those that depend on the one that changed.

pkg_libchk will identify any port binary that is missing a library, which should find the ones with problems.

yes, pkg_libchk will identify any port with a "missing" library; but it will not identify those ports which will be orphaned after make delete-old-libs is executed. Immediately after an upgrade, the old libs are still present in /lib, /usr/lib, etc. so links to "old" libraries are still viable. One might first delete the old libs and later run pkg_libchk to note which ones have been broken, but in the interim all such ports' applications will fail. [pain]

After upgrading from 9.3 to 10.1 one can examine /usr/lib and note that the "default" version of libarchive.so (for example) is now libarchive.so.6 (discernible because the .so symlink now points to the .so.6 lib). At the same time, the older .so.5 version is still present.

So the question (better phrased) is:

After upgrading FreeBSD, is there a tool which can be used to list installed ports which are linked against older (now out of date) versions of core libraries without first deleting those out-of-date libraries and causing the aforementioned programs to core-dump?

The avowed best-practice (post FreeBSD upgrade) appears to be to force a rebuild of all installed ports (e.g.: portmaster -af) in order to relink against newer libraries; however, a blanket upgrade of all ports all at once is fraught with pain; so I would much rather work from a list and perform the upgrades piecemeal and test after each to be sure I haven't broken anything.

While it is obvious to assume that immediately after an OS upgrade ~none~ of the installed ports will be linked against the freshly installed libs, it would be nice to be able to check the upgrade status of ports after first a rebuild of perl and later after a rebuild of mariadb55-server and even later after a rebuild of postfix. Each rebuild will pull in some number of requirements so the list of ports linked against out-of-date libs will shrink.

Is there a practicable method for generating a list of those ports which need upgrade?

Thank you again.
 
I am not 100 % sure whether I understood your objective correctly. If you want to know all ports which are linked against for example libssl.so.7, then on FreeBSD 10.1 you could use the following command:

find /usr/local/bin /usr/local/sbin /usr/local/libexec /usr/local/lib -type f | xargs -n1 file -F ' ' | grep ELF | cut -f1 -d' ' | xargs ldd -f '%A %o\n' | grep "libssl.so.7" | cut -f1 -d' ' | sort -u | xargs -n1 pkg which | cut -f6 -d' ' | sort -u

Be prepared that it will take minutes until the long pipe spills something out.

Thank you for that, but I'm looking for a list of all currently installed ports potentially linked against ANY "out-of-date" libraries (see my other reply for an obsessively long explanation). pkg_chklib seems to come closest; but I'm beginning to resign myself to writing my own script.
 
Back
Top