"Linux Gazette...making Linux just a little more fun! "

Binstats: Finding Unusable Binaries

by Larry Ayers

Copyright (c) 1996

Published in Issue 9 of the Linux Gazette

Like many other Linux users, I've strayed from the path of my originally installed distribution (Slackware 3.00) and have updated quite a large percentage of the packages and libraries. This can lead to problems; these might come my attention when starting up a long-neglected executable only to receive a message indicating that an essential library is missing, or that a library has an incompatible executable format.

Of course, you could spend a couple of hours every month or so and run ldd on each and every executable on your system, writing down the results for every one which has errors. This could become tedious, I imagine.

Peter Chang is evidently a whiz at cobbling together shell scripts which use various Unix utilities chained and piped one to another. Binstats is one of his, and it is truly an ingenious contrivance. You start it up (after editing it so that it knows where all of your /bin directories are), the hard disc grinds away for a minute or three, and this little script presents you with a list of all the poor orphaned programs which can't run due to a lack of shared libs. It also lists how many of each type of executable (ELF, QMagic, statically linked, etc.) you have, and which shared libs you have which aren't needed by any of your executables.

What really blew my mind was seeing a long list of duplicated executable names, an unexpected result of many upgrades. This can be a result of this imaginary scenario: Joe has been maintaining Package X for several years and is weary of the constant email. He gratefully transfers the maintenance of Package X to an eager, energetic young programmer, Ed. Ed is appalled to find an installation procedure which doesn't follow the Linux Filesystem Standard, and immediately changes the default installation directory from /bin to /usr/local/bin. Yours truly logs in at sunsite.unc.edu, finds a new version of Package X, installs it, and is happy to see the new functionality. Unfortunately the old Package X executable is living out the remainder of its days, unknown to all, in /bin. Then Binstats does its work and the old X binary and all its hoary cohorts are brought to light.

All of the functions of Binstats can be done "by hand", of course. The beauty of this shell program is the combination of tasks into one, with the results logged to a text file. Then you can see at a glance several system administration jobs which should be taken care of.

Binstats is only four and one-half kb. archived in tgz format. A copy of the latest version is available at this UK site, as well as in this sunsite directory. It's well worth the short download time, even if you only run it once.

Larry Ayers<layers@vax2.rain.gen.mo.us>