Now I'm really confused:
I start with an unmerged sid chroot, install 9base there.
Then I remove /etc/unsupported-skip-usrmerge-conversion and install
usrmerge.
Now /etc/shells contains
# /etc/shells: valid login shells
/bin/sh
/bin/bash
/bin/rbash
/bin/dash
/bin/rc
/usr/lib/plan9/bin/rc
/usr/lib/plan9/bin/rc
/usr/bin/sh
/usr/bin/bash
/usr/bin/rbash
/usr/bin/dash
/usr/bin/rc
and /var/lib/shells.state
/bin/bash
/bin/rbash
/bin/dash
/bin/rc
/usr/lib/plan9/bin/rc
/usr/lib/plan9/bin/rc
Then I run update-shells which does not modify /etc/shells, but the
statefile now contains
/bin/bash
/usr/bin/bash
/bin/rbash
/usr/bin/rbash
/bin/dash
/usr/bin/dash
/bin/rc
/usr/lib/plan9/bin/rc
/usr/lib/plan9/bin/rc
So the /bin entries for bash/rbash/dash get their /usr counterparts
added, but /bin/rc does not.
OK, back to the minimal unmerged sid chroot, without 9base this time.
After installation of usrmerge and successful conversio /etc/shells contains
# /etc/shells: valid login shells
/bin/sh
/bin/bash
/bin/rbash
/bin/dash
/usr/bin/sh
/usr/bin/bash
/usr/bin/rbash
/usr/bin/dash
and /var/lib/shells.state contains
/bin/bash
/bin/rbash
/bin/dash
Then I delete all /usr/bin entries from /etc/shells
(sed -i /usr/d /etc/shells) and run update-shells, resulting in
/etc/shells containing
# /etc/shells: valid login shells
/bin/sh
/bin/bash
/bin/rbash
/bin/dash
/usr/bin/bash
/usr/bin/rbash
/usr/bin/dash
(i.e. only /usr/bin/sh is missing compared to the file made by usrmerge)
and the statefile contains
/bin/bash
/usr/bin/bash
/bin/rbash
/usr/bin/rbash
/bin/dash
/usr/bin/dash
This seems to imply that usrmerge could call update-shells to perform
most of the changes it does to /etc/shells. (And to update
/var/lib/shells.state at the same time)
... later ... much later ...
After reading update-shells several times (and still not fully getting
how it works (or at least should work)), I think its behavior is not
well defined in the context of alternatives as used by 9base.
At least this line seems to be wrong:
realshell=$(dirname "$(dpkg-realpath --root "$ROOT"
"$line")")/$(basename "$line")
It resolves e.g. /usr/bin/clang++-14 to
non-existant /usr/lib/llvm-14/bin/clang++-14
Shouldn't that rather be
realshell=$(dpkg-realpath --root "$ROOT" "$(dirname
"$line")")/$(basename "$line")
Andreas