FS#45640 - [tcsh] sed issues in tcsh.install

Attached to Project: Community Packages
Opened by Nicolas Bigaouette (big_gie) - Monday, 13 July 2015, 19:28 GMT
Last edited by Eli Schwartz (eschwartz) - Monday, 14 August 2017, 01:40 GMT
Task Type Bug Report
Category Packages
Status Closed
Assigned To Lukas Fleischer (lfleischer)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

I couldn't login after the last update to tcsh. After investigation, it ended up that /etc/shells had been modified in a way that removed my login shell from it which prevented users from loging in.

The post_upgrade() function from tcsh.install [1]
contains a sed call that changes all "/usr/bin/tcsh" to "/bin/tcsh" (same for csh). The problem is that it can match any substrings. On this specific machine, the login shell _has_ to be /opt/usr/bin/tcsh so I have such an entry in /etc/shells. Thus the sed call changed that line to "/opt/bin/tcsh" which prevented me from login in.

Wouldn't something like:
sed -i 's|^/usr/bin/tcsh$|/bin/tcsh|g' etc/shells
instead of
sed -i 's|/usr/bin/tcsh|/bin/tcsh|' etc/shells
be better (and same for all other sed calls)?
Note the "^", "$" and also the "g". While using both "^" and "$" would prevent substring substitution, the "g" would make sure any duplication get changed too.

https://projects.archlinux.org/svntogit/community.git/tree/trunk/tcsh.install?h=packages/tcsh
This task depends upon

Closed by  Eli Schwartz (eschwartz)
Monday, 14 August 2017, 01:40 GMT
Reason for closing:  Fixed
Additional comments about closing:  tcsh 6.20.00-1
Comment by Allan McRae (Allan) - Monday, 28 March 2016, 09:52 GMT
Never remove or alter anything from /etc/shells. Just add.

Loading...