[arch-general] A good time to switch to dash as /bin/sh?

Mateus Rodrigues Costa charles.costar at gmail.com
Fri Sep 26 15:02:33 UTC 2014

Sorry for not contributing much to this discussion, but I found this:
Someone mentioned that Ubuntu and Debian made the change from bash to dash
a long time ago. So here's the document about the Ubuntu switch.

"The major reason to switch the default shell was efficiency. bash is an
> excellent full-featured shell appropriate for interactive use; indeed, it
> is still the default login shell. However, it is rather large and slow to
> start up and operate by comparison with dash"

Bash is still the default login shell. The sh symlink change was mostly
because of performance when using shell scripts for the init system, which
is a problem we don't have now with systemd.

The Debian policy manual has long mandated that "shell scripts specifying
> '/bin/sh' as interpreter must only use POSIX features"; in fact, this
> requirement has been in place since well before the inception of the Ubuntu
> project. Furthermore, any shell scripts that expected to be portable to
> other Unix systems, such as the BSDs or Solaris, already honoured this
> requirement. Thus, we felt that the compatibility impact of this change
> would be minimal.

Here is a good point about why making dash our /bin/sh shouldn't be a
problem: If something needs bash, it should ask for bash; if it asks for
sh, it should only get sh (sometimes because the system can only give sh).

Of course, there have been a certain number of shell scripts written
> specifically for Linux systems, some of which incorrectly stated that they
> could run with /bin/sh when in fact they required/bin/bash, and these
> scripts will have broken due to this change. We regret this breakage, but
> feel that the proper way to address it is to make the small changes
> required to those scripts, discussed later in this document. In the longer
> term, this will promote a cleaner and more efficient system.

(This applies the same philosophy as in C and C++. Programs should be
> written to the standard, and if they use extensions they should declare
> them; that way it is clear what extensions are in use and they will at
> least fail with a much better error message if those extensions are not
> available.)

Someone here mentioned that one of the principles of Arch Linux is "code
correctness over convenience".
So, for the scripts that use bashisms but ask for sh: We, working together
with upstream, change them to either only use sh features or to ask for
bash instead.

Mateus Rodrigues Costa

More information about the arch-general mailing list