Thanks Greg!
That was... well, as expected ;-)
Am 18.11.2024 um 13:35 schrieb Greg Wooledge:
On Mon, Nov 18, 2024 at 11:57:05 +0100, Arno Lehmann wrote:
...
Unfortunately, I'm not brilliant at all.
But I'm eager to see if Greg has something to educate us ;-)
POSIX doesn't care whether you ship separate binary files or a single
binary file
so far I'm aware of that...
... find that the two
programs shared a single binary file, and either used a hard link or
a symbolic link from one to the other. That was fashionable in the
past, primarily as a means of reducing disk space usage.
Indeed that is kind of what I expected.
In recent years, GNU has tried to do away with the whole "this program
may be invoked by any of the following names, and it changes it behavior
based on which name it finds in argv[0]" approach. From
<https://www.gnu.org/prep/standards/standards.html#Standards-for-Interfaces-Generally>:
And that is something I wasn't aware of.
...
If you look around a bit, you'll find that commands which *used* to share
a common file (grep/egrep/fgrep, gzip/gunzip/zcat) have started shipping
a single compiled binary file and a set of wrapper shell scripts for
the alternative names. E.g.:
As well as that and your examples. Well, I could have known. As it
happens, I've been working a bit with unexpected system states on lvm
using storage, and thus might have been slightly biased the other way:
$ ls -l /sbin/ | grep -- '-> lvm' | wc -l
43
A wrapper script can't be used to differentiate test and [, however,
because of the way the final argument is treated.
Actually, I'm kind of sure it would be possible, but it would also be
pretty stupid to do so, as such a "wrapper" script would probably be
more complex than the binary it wraps... also, I've been provoking you
already ;-)
Thanks,
Arno
--
Arno Lehmann
IT-Service Lehmann
Sandstr. 6, 49080 Osnabrück