Question about packaging of common shells
Hi, I was looking at the Arch Linux PKGBUILDs of common shells since I was working on a PR to update the fish package - which had been already out for over 10 days without an update - and I noticed something which I thought was a bit strange. In the PKGBUILD for fish, the post_install step is defined as follows:
post_install() {
grep -qe '^/usr/bin/fish$' etc/shells || echo '/usr/bin/fish' >> etc/shells
grep -qe '^/bin/fish$' etc/shells || echo '/bin/fish' >> etc/shells
}
(same thing applies for the zsh package).
This makes for a redundancy in the /etc/shells file as I now have two entries listing Fish as shells installed on my system. In fact, my /etc/shells looks like this (minor the comments at the top of the file):
/bin/sh
/bin/bash
/usr/bin/git-shell
/usr/bin/fish
/bin/fish
Unless I'm missing something, that seems unnecessary since, on Arch Linux, /bin is symlinked to /usr/bin so they're essentially the same file. Not only that, but neither /bin/sh nor /bin/bash is repeated in the same fashion (and neither is /usr/bin/git-shell too, even though it's in a different location).
As I mentioned above, this is not a problem in the Fish package but I saw the same thing for Zsh. Is there any reason for this? Also, would it be a good idea to change it so that it only lists shells under /bin?
Edited 27 Feb 2020. We only hold this version.
About this post
- Posted
- Archived
- Edited
- Score
- 13 · 100% up
- Kind
- Text
- ID
- fa30vv
12 comments
My first thought is that being listed in /etc/shells would be necessary to change the shell with 'chsh', but actually I tried it and it just throws a warning if the shell isn't listed.
But it doesn't resolve symlinks, so trying to 'chsh' to /usr/bin/bash gives a warning. However, since both locations are listed for fish, you can 'chsh' to both /bin/fish and /usr/bin/fish without warning. That looks very trivial though, I wonder if there's something more to it.
I hadn't thought about the ability to use both paths for
chsh. Still, that looks a bit ugly as the same pattern isn't repeated for Bash. Also, being "forced" tochshonly/bin/*doesn't sound like too big of a deal to me. I would rather have a more consistent/etc/shells.chshis not a command you run everyday anyway (I hope).Must be for compatibility, its safe to assume that, someone, somewhere uses chsh -s /bin/fish and someone else chsh -s /usr/bin/fish
https://git.archlinux.org/svntogit/community.git/commit/trunk/fish.install?h=packages/fish&id=ae4c23711d4b0910324daef5f36fd90fff94722c
The /bin/fish entry was added on the last update, until then there was only /usr/bin/fish. I guess the maintainer didn't want to deal with possible compatibility issues, especially when the only benefit would be "only" a redundant entry in /etc/shells.
No, it was added because chsh was failing to change the shell if it wasn't in
/etc/shells.No! Yes! I mean the other one wasn't removed, probably because of possible compatibility issues.