On 3/24/22 9:45 AM, Ottavio Caruso wrote:
Thanks it makes sense, but I'd like to rephrase my question (and
sorry that I didn't do my homework. I genuinely don't have a stable
Internet connection and I have to rely to the *couch* public library
or what remains of it):
IMHO there's no need to apologize. I consider the nature of discussions
to involve learning and / or corrections and / or clarifications.
How can I check that a number of programs are installed _and_ point
to a true executable rather than a shell script or similar?
It sounds like you mean "binary" as opposed to "executable". I consider scripts to be executables.
I'd suggest focusing on a (repeatable) process to check an individual
file to determine if it meets your standards or not.
Once you have that process you would loop across the list of files to
see if each file.
Now, I prevent one of the possible objections: Debian makes great
use of alternatives[1], therefore most programs do point to a shell
script or a link rather than an executable. I'll have to make an
explicit exception for Debian/Ubuntu and similar.
I know that some programs actually use sym-links to provide varies ways
to invoke the compiled binary. BusyBox is an example of such a
quintessential binary wherein many different command names link to one
binary and the binary behaves differently based on the invoking name.
Another example is contemporary Solaris systems making /bin itself a
sym-link to /usr/bin. So, what would you consider /bin/ls which is (indirectly) a sym-link to /usr/bin/ls.
Aside: What if hard links are used in lieu of sym-links?
Without a clear definition of what a proper executable (binary?) is,
it's near impossible to derive a test that takes into account many
different things that Unix has done over the years. Especially if you
want to account for more esoteric things like over-mounting, hard links, LD_PRELOAD interceptions, etc.
--
Grant. . . .
unix || die
--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)