Many executables across Debian's archives share basenames
- Date: Thu, 05 Oct 2017 22:07:24 +0200
- From: harry666t@xxxxxxxxx (Kamil Cholewiński)
- Subject: Many executables across Debian's archives share basenames
I wrote a short script that calls "apt-file find 'bin/'", filters
results to include only stuff from /bin:/sbin:/usr/bin:/usr/sbin, and
looks for basename clashes. Turns out, in Stretch, there are 97 hits.
(If you also include /usr/games, 126.)
(Of couse, I'm counting all packages, regardless of whether they specify
"Conflicts:" or not, and regardless of whether the full name is shared,
or just the basename.)
For example, packages "389-ds-base" and "dmucs", both provie a command
called "monitor". The former's command is located in /usr/sbin, the
latter's in /usr/bin. Neither package conflicts with the other.
I think this has at least two implications:
1. Which exact executable gets called using a given command, depends
entirely on $PATH, which, let's face it, is sometimes a mess (as
scripts, .profile's, .bashrc's, third-party installers, automagic
pasta, etc like to redefine and manipulate it).
Some of these commands are obviously compatible (or at least are
well-known, and have a lowest common denominator) and work fine as
drop-in replacements, like newaliases or mailq.
Some however, have different behavior (like rm from coreutils vs from
safe-rm), or are actually completely unrelated (like ztest from
zfsutils-linux and from zutils).
Scripts that rely on the existence of a command, will usually just look
for it in $PATH and assume it's the one they're expecting - I doubt many
people care to parse "foo --version" for all 17 possible implementations
of foo (including GNU Coreutils, all the BSDs, etc). I've seen this in
the wild a lot, I'm guilty of this myself, and I honestly wouldn't
expect "arcstat" to do two completely different things on a system with
ZFS, and on a system with Nordugrid (and what happens when both are
installed is entirely up to $PATH...).
2. (I know this is crazy, unsupported, violates FHS, kills kittens, and
I'm actually Asking For Trouble by doing this, but whatever.) I can't
safely symlink /sbin to /bin, and I can't do a /usr -> / either.
Which kinda sucks, as some Other Distros have done it and are happily
rolling with it. I know some programs will attempt weird things, or
outright freak out if this happens (I know VirtualBox used to freak out
when /usr was a symlink at all), but at least theoretically (or at least
as long as no other filename clashes happen), this should be totally
possible and kinda safe.
So, is this a bug? Is this of concern? Am I making sense?
Should I file bugs against packages that don't supply "Conflicts:"?
Should we embark on a renaming crusade? Or just leave it be?
In any case, if anyone is interested in further research, this is the
script and results for Stretch:
Please CC me in replies, I'm not a subscriber.