[Dev] Setting dash as default shell (or getting rid of bash)

Aleksander Zdyb a.zdyb at partner.samsung.com
Thu Sep 26 12:40:19 GMT 2013


Hello everyone.

In order to prepare a minimal distribution of TIZEN 3.0, I'm considering 
replacing bash as a default shell (/bin/sh) with dash.
The goal is to reduce size of image and (possibly) boost performance.

My goal is not to kick bash out of TIZEN, but to provide it only as an 
optional component. It will still be available for installation, if 
there are any scripts needing it or if user console is to be provided.

I've managed to build such an image, where /bin/sh points to dash and 
it's bootable and functional. However it was impossible to get rid of 
bash entirely. It's because of some (mostly artificial) dependencies on 
/bin/bash.

There are three groups of dependencies on bash:
1. Real dependencies -- scripts relaying on bash functionalities and/or 
syntax (bashisms [1]),
2. Artificial dependencies -- scripts declared as bash, but not really 
using any of its benefits,
3. Spec scripts -- there are many commands using syntactic sugar of bash.

It's hard to identify instances of first two groups. Most packets don't 
mark their dependency on bash in spec files. In some cases, the 
dependency is automatically revealed by rpm during build. This is 
however very unreliable and requires building the packages. Moreover 
it's nearly impossible to track changes in hidden (i.e. automatically 
found) dependencies.

The 3rd group can be eliminated gradually or, if there is a way to 
preserve bash as default shell in building environment, leaving it as it is.

Now, I would like to ask everyone to:
1. eliminate unnecessary usage of bash in additional scripts provided as 
source/patches to packages in the future,
2. add Requires/BuildRequires in spec files in case, the package needs 
bash, instead of relaying on automatic dependency detection,
3. not using bashisms in spec files [1][2],
4. share thoughts and ideas on this topic.

I will be eliminating dependencies on bash in packages, I encounter 
while working on the minimal image, I'm preparing.
Please share your thoughts and ideas on this topic.

[1] http://mywiki.wooledge.org/Bashism
[2] https://wiki.ubuntu.com/DashAsBinSh


-- 
Aleksander Zdyb
Samsung R&D Institute Poland
Samsung Electronics



More information about the Dev mailing list