[Bug 297394] Default shell changing from csh to sh has unexpected fallout
| Newsgroups | gmane.os.freebsd.bugs |
|---|---|
| Message-ID | <[email protected]/bugzilla/> |
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=297394
Bug ID: 297394
Summary: Default shell changing from csh to sh has unexpected
fallout
Product: Base System
Version: 15.1-RELEASE
Hardware: Any
OS: Any
Status: New
Severity: Affects Many People
Priority: ---
Component: bin
Assignee: [email protected]
Reporter: [email protected]
I just spent 3 hours trying to figure out why an important/critical FreeBSD
port, spamassassin, would no longer work correctly. Specifically: sa-update
would fail with Perl taint errors talking about the env var called $ENV being
set, and sa-compile would fail stating it couldn't find re2c binary despite it
being in /usr/local/bin.
The root cause of all of this seems to be:
https://www.freebsd.org/releases/15.1R/relnotes/
The default shell for the root user and the 'freebsd' user in release images is
changed from csh(1) to sh(1). c8763bd078d8.
Commit: https://cgit.freebsd.org/src/commit/?id=c8763bd078d8 , author bapt.
I have laughed for decades at how FreeBSD always used csh as the default root
shell, and -- if you changed it to sh or bash or anything else -- various
things (esp. ports) would "misbehave" in very strange ways. Now it seems we
have the exact same problem but in reverse.
There is a clear difference on FreeBSD 15.1 between root shell being /bin/csh
vs. /bin/sh, and when root shell is invoked via "sudo su -". $ENV does end up
being set when /bin/sh is root's shell, and that's due to what's in
/root/.profile (been this way for 27 years). See sh man page for what that god
awful nonsense is about.
I am not going to spend the time to figure out why this is manifesting the way
it is, but it is clear this change has fallout. Let's demonstrate:
First, with /bin/sh:
$ sudo su -
root@mambo:~ # env | egrep 'SHELL|ENV|PATH'
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/root/bin
ENV=/root/.shrc
SHELL=/bin/sh
root@mambo:~ # which sa-update
/usr/local/bin/sa-update
root@mambo:~ # which sa-compile
/usr/local/bin/sa-compile
root@mambo:~ # which re2c
/usr/local/bin/re2c
root@mambo:~ # sa-update
Insecure $ENV{ENV} while running with -T switch at
/usr/local/lib/perl5/site_perl/Net/DNS/Resolver/UNIX.pm line 48.
Compilation failed in require at /usr/local/lib/perl5/5.42/base.pm line 137.
...propagated at /usr/local/lib/perl5/5.42/base.pm line 159.
BEGIN failed--compilation aborted at
/usr/local/lib/perl5/site_perl/Net/DNS/Resolver/Base.pm line 31.
Compilation failed in require at /usr/local/lib/perl5/5.42/base.pm line 137.
...propagated at /usr/local/lib/perl5/5.42/base.pm line 159.
BEGIN failed--compilation aborted at
/usr/local/lib/perl5/site_perl/Net/DNS/Resolver.pm line 16.
Compilation failed in require at /usr/local/lib/perl5/site_perl/Net/DNS.pm line
43.
Compilation failed in require at /usr/local/bin/sa-update line 87.
BEGIN failed--compilation aborted at /usr/local/bin/sa-update line 87.
Use of uninitialized value $name in scalar chomp at
/usr/local/lib/perl5/site_perl/Net/DNS/Resolver/UNIX.pm line 22.
Use of uninitialized value $name in split at
/usr/local/lib/perl5/site_perl/Net/DNS/Resolver/UNIX.pm line 23.
root@mambo:~ # sa-compile
Can't exec "re2c": No such file or directory at /usr/local/bin/sa-compile line
114.
Now we switch to /bin/csh and do the same thing:
root@mambo:~ # chsh -s /bin/csh
chsh: user information updated
root@mambo:~ # exit
$ sudo su -
root@mambo:~ # env | egrep 'SHELL|ENV|PATH'
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/root/bin
SHELL=/bin/csh
root@mambo:~ # which sa-update
/usr/local/bin/sa-update
root@mambo:~ # which sa-compile
/usr/local/bin/sa-compile
root@mambo:~ # which re2c
/usr/local/bin/re2c
root@mambo:~ # sa-update
root@mambo:~ # sa-compile
Aug 9 05:14:07.958 [7522] info: generic: base extraction starting. this can
take a while...
Aug 9 05:14:07.958 [7522] info: generic: extracting from rules of type
body_neg2000
{...snipping for brevity...}
Someone needs to figure out what the root cause of this behaviour is. It's
clearly a combination of $ENV being set due to /root/.profile and whatever
terrible thing is causing sa-compile to "misbehave" with $PATH despite the
binary clearly being in $PATH and $PATH being the same between /bin/sh and
/bin/csh.
I am not going to spend any more time on this. chsh -s /bin/csh as root and
I'm calling it a done day. Someone else can figure out this mess.
--
You are receiving this mail because:
You are the assignee for the bug.