Skip to content

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.

13 points12 comments
Open on Reddit
About this post
Posted
Archived
Edited
Score
13 · 100% up
Kind
Text
ID
fa30vv

Author

7
posts
149
comments
1
media
View profile

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.

5 points

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" to chsh only /bin/* doesn't sound like too big of a deal to me. I would rather have a more consistent /etc/shells.
chsh is not a command you run everyday anyway (I hope).

2 points

Must be for compatibility, its safe to assume that, someone, somewhere uses chsh -s /bin/fish and someone else chsh -s /usr/bin/fish

3 points
unknown author2 hidden

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.

2 points

No, it was added because chsh was failing to change the shell if it wasn't in /etc/shells.

2 points
unknown author

No! Yes! I mean the other one wasn't removed, probably because of possible compatibility issues.

2 points

Keyboard shortcuts

Move and act

jork
Next / previous post or comment
Enteroro
Open the post
f
Open the media viewer
s
Save
h
Hide (the toast has Undo)
Tab
Right after an action: the toast's Undo
x
Collapse the comment
v
Next layout: cards, compact, grid

Go to

/
Search
gthenh
Home
gthena
All
gthens
Subreddits
gthenl
Library
?
This list
Esc
Close a menu or this list

In the viewer

←or→
Previous / next file
↑or↓
Previous / next post
korj
Previous / next post
Space
Play / pause
m
Mute
z
Zoom
s
Save
o
Open the post (on its own page: back to it)
Esc
Close

Keys do nothing while you type in a box.