[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Making init scripts use dash



On Thu, May 18, 2006 at 05:27:23PM -0300, Margarita Manterola wrote:
> During some tests I've performed, I've found that making the init
> scripts run with dash as default shell instead of bash makes the boot
> time a 10% faster (6 seconds in a 60 second boot).
> 
> To make this speed up available to everyone, we have 2 main choices:
> 
> 1. Make /bin/sh point to /bin/dash
> 2. Change #!/bin/sh for #!/bin/dash in the scripts
> 
> There are arguments for and against both of them.  I'm summarizing
> what I've gathered during Debconf, but I do want to hear other
> people's opinions.
> 
> Option (1) implies making dash base and Essential: yes (currently dash
> is optional), and that would imply that until no Essential package
> depends on bash, we would have two shells in Essential.  Moving bash
> out of Essential would probably imply two release cycles (i.e. it
> couldn't be out of Essential until etch+2).
> 
> This option also might imply some extra bugs, but it's believed that
> not so many, since there are already quite a number of people with
> /bin/sh -> /bin/dash, and they do file bugs when "bashisms" appear.

It's also influencing the whole system, including any #!/bin/sh scripts
that anyone might have installed locally. It's very easy to make a
bashism that then will fail to work with /bin/sh, I think the risk of
breaking things of users is way too high for me to consider this. Bash
is a very decent all-round shell.

> Option (2), on the other hand, implies that package maintainers have
> to manually edit init scripts (or apply patches) and add the correct
> dependency.  This would mean quite a number of uploads, that might
> take quite a lot of time.

initscripts are only a very small subset of shellscripts anywhere, and
especially a controllable and overseeable subset. Despite the fact that
it requires changes to all packages having init scripts, I think this is
worth the effort. It ensures that these tweaks for startup improvements
are really confined to the init scripts, and also, bugs will be found
very quickly this way, because everyone will be using dash for those
scripts then.

Of course, all the packages in question must then depend on dash, but
that's not really a problem IMHO. The only problem I do see is that dash
currently asks a question upon installation, which I think it should
simply stop doing so, administrators who want this change can really do
update-alternatives themselves, the default is IMHO sane (keep bash as
/bin/sh). For most applications the speed improvement is neglectable
anyway, and IMHO we should only optimise where a speed gain is really
significantly present (as in this case).

> So, mainly the question that I want to ask of the rest of the Debian
> community is if there are more arguments for or against these options,
> and what do you think would be the best route on implementing this.

Afaik, there isn't really a widely recognised decision of any sort on
this. I think what should happen now is for you to publish on this list
your benchmark results about the speed gain w.r.t. dash, and
consequently getting policy changed to get it to state that init scripts
"should" use #!/bin/dash. Then lintian can gain a warning about scripts
not complying, and bugs with patches can be filed on all relevant
packages, and eventually NMUd where needed (but I don't think it'll be
often needed once the policy change is accepted by the policy making
process).

Your alternative (1) proposal is also more complicated to get done, and
does not allow users to have bash as /bin/sh, but still the bootup time
improvements. Without this possibility, I'm myself at least not in
favour of going this way at all.

--Jeroen

-- 
Jeroen van Wolffelaar
Jeroen@wolffelaar.nl (also for Jabber & MSN; ICQ: 33944357)
http://Jeroen.A-Eskwadraat.nl



Reply to: