Current proposal to make /bin/sh the default shell for root

trev

Daemon

Reaction score: 301
Messages: 1,024

For those who would not otherwise see it - From the FreeBSD Current mailing list:

Date: Wed, 22 Sep 2021 10:36:45 +0200
From: Baptiste Daroussin <bapt@FreeBSD.org>
To: current@freebsd.org, arch@FreeBSD.org
Subject: [HEADSUP] making /bin/sh the default shell for root

Hello,

TL;DR: this is not a proposal to deorbit csh from base!!!

For years now, csh is the default root shell for FreeBSD, csh can be confusing
as a default shell for many as all other unix like settled on a bourne shell
compatible interactive shell: zsh, bash, or variant of ksh.

Recently our sh(1) has receive update to make it more user friendly in
interactive mode:
* command completion (thanks pstef@)
* improvement in the emacs mode, to make it behave by default like other shells
* improvement in the vi mode (in particular the vi edit to respect $EDITOR)
* support for history as described by POSIX.

This makes it a usable shell by default, which is why I would like to propose to
make it the default shell for root starting FreeBSD 14.0-RELEASE (not MFCed)

If no strong arguments has been raised until October 15th, I will make this
proposal happen.

Again just in case: THIS IS NOT A PROPOSAL TO REMOVE CSH FROM BASE!

Best regards,
Baptiste
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 12,735
Messages: 39,332

It's a good thing those improvements have been made because the current sh(1) is rather spartan when it comes to interactive use.
 

kpedersen

Son of Beastie

Reaction score: 2,163
Messages: 3,005

"as all other unix like settled on a bourne shell compatible interactive shell: zsh, bash, or variant of ksh."

This is a bit of a poor argument. There are so few unix platforms left that FreeBSD pretty much gets to make its own rules these days ;)
 

obsigna

Daemon

Reaction score: 899
Messages: 1,295

In the last days, I ran through a major overhauling of my websites, and I used sed(1) for batch changing/adding/deleting tags and attributes of hundreds of pages. I became tired of figuring out what's the escape sequence for example of \" in tcsh, and initially I entered sh(1) before sediting. Lately, I abandoned tcsh and switched to bash. Look, I tried hard to stay away from this GNU stuff, but tcsh is simply a PITA when it comes to more sophisticated commands.
 

vigole

Daemon

Reaction score: 1,562
Messages: 1,393

I've been using sh(1) with "-o vi" option for a long time. Recently, I've changed my default (Normal user) to the ksh(1). In short, I think the proposal is a good one.

Back in the FreeBSD 6.2, I was using tcsh(1) for a short period of time. I had this false impression that it must have something to do with C language. I was wrong!
 

sidetone

Daemon

Reaction score: 922
Messages: 1,885

I rather the default stay with csh than sh, or it use mksh or another implementation of ksh.

I need auto-completion for some commands.
 

sidetone

Daemon

Reaction score: 922
Messages: 1,885

I have to see it first. sh had history, where I can use an arrow key, but it toggled through the whole history, instead of starting at those that matched the first typed letters.

I'm more comfortable with mksh or another ksh than anything else.

When I used mksh as default, I had to remember to reinstall it when I upgraded, or I wouldn't be able to make fixes or would have problems continuing setting up. I stick with csh, because of this.
 

Zirias

Son of Beastie

Reaction score: 1,701
Messages: 2,870

1996 called. They want their headline back.
Just in case, that was sarcasm. POSIX mandates /bin/sh is a bourne shell. So making it also the default shell for root is kind of what you'd expect.
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 12,735
Messages: 39,332

sh had history, where I can use an arrow key, but it toggled through the whole history, instead of starting at those that matched the first typed letters.
History isn't (or wasn't) persistent either. Not sure what "support for history as described by POSIX." actually means. Does that include persistent history?
 

sidetone

Daemon

Reaction score: 922
Messages: 1,885

Does that include persistent history?
I don't know.

When I type in complex commands for csh or mksh, I can type part of it, then use my arrow keys to get auto-completion or history that starts with the matches of what I typed this time.

I tried sh again just now, and while I can type part of a command, my arrow key scrolls though all recent commands, regardless of what I typed.

When I'm using ImageMagick, I need to scroll from the point of a typed prefix to make minor adjustments, which is further back in history, than other commands. Also for any other command.
 

Zirias

Son of Beastie

Reaction score: 1,701
Messages: 2,870

I didn't even know POSIX described a history feature. But I'm a bit amused by the expectation that people would go bananas if removal of tcsh from base might be discussed 🥳

What a base system needs is a bourne shell. What it also needs is a (somewhat) comfortable interactive shell, cause there are situations when base is all you have at hands. So far so good. Making FreeBSD's /bin/sh more comfortable sounds like a nice idea to me. So you *might* think that tcsh *might* become superfluous. Haha…

Even then, what's the problem? You can use any shell you like anyways, and if you want a non-base shell for root, that's what the "toor" alias is for.
 

gpw928

Aspiring Daemon

Reaction score: 270
Messages: 596

I don't really think it matters what shell is assigned by default to the root account.
I have lived with csh there for a very long time, and managed to ignore it completely (at an ongoing cost of maintaining my own copy of /bin/ksh).
Opinions will vary on the most suitable replacement, and many will be dissatisfied, no matter what is chosen.
I have observed, several times, that I don't want to be using a strange shell with strange syntax (and desperately needing to refer to man csh) when the chips are down.
So I do think it matters (a lot) what shells are available for use in single user mode with the base system installed.
BSD systems have a very long history of using csh for root, but I do believe that csh has fallen into disuse (for good reasons).
Every other Unix variant I can think of uses a Bourne compatible shell for the root account ( bash, dash, ksh, to mention a few).
So, I think a Bourne compatible shell is a good idea, but I'm not going to fight for any particular one.
Back when an RL02 disk was 10 MiB, limiting the size of the root was mandatory. These days 100 GiB thumb drives can be had for $20.
I would fight to see a raft of common shells available in single user mode, so exec /bin/ksh or exec /bin/bash just rolled off the fingers...
 

rustbucket

New Member

Reaction score: 6
Messages: 3

Personally I find it incredibly confusing to have to use one syntax for interactive use and a different syntax for scripting.

I 100% agree.

Even though I know both well, I unintentionally swap things; it gets a little annoying.
 

astyle

Daemon

Reaction score: 646
Messages: 1,459

Personally, I'm happy with sh(1) being the default right now. Yeah, it's a bit spartan, but that's the idea - I think you gotta keep it simple as much as practical. Other shells are actually available in ports, they can be installed on an 'as needed' basis to suit user preferences. 😩
🤷‍♂️
 
Top