1 |
On Tue, 6 Feb 2007 23:26:32 +0000 |
2 |
Roy Marples <uberlord@g.o> wrote: |
3 |
|
4 |
> On Tue, 6 Feb 2007 21:28:04 +0000 |
5 |
> Ciaran McCreesh <ciaranm@×××××××.org> wrote: |
6 |
> |
7 |
> > I think it's more that you're expected to justify *why* the bash |
8 |
> > requirement is so bad, given the cost of changing. |
9 |
> |
10 |
> 1) Lack of choice. |
11 |
> Gentoo is all about giving the user choice. baselayout even supports |
12 |
> other init systems when requested. |
13 |
|
14 |
Surely you would provide choice by providing different baselayout |
15 |
packages; one tailored for embedded systems that only have busybox, one |
16 |
for general purpose use, etc. That's what the virtual is for, isn't it? |
17 |
|
18 |
> 2) Speed. |
19 |
> Bash is one of the slowest shells around for looping. |
20 |
> However, it also requires less forking due to it's nice built-ins. |
21 |
> This does of course only work with bash and not other shells. |
22 |
|
23 |
Restricting everything to 'sh' I think is more likely to slow things |
24 |
down than anything else. Apart from the forking issue that you |
25 |
mention, builtins are different - '[' for example is about 30% slower |
26 |
than '[[' in bash (which is what's implementing sh on Gentoo Linux). I |
27 |
wonder how much time would be saved on Gentoo Linux by replacing [ with |
28 |
[[ throughout the init scripts; maybe a percentage point? |
29 |
|
30 |
If there really is a big speed penalty from using bash on BSD compared |
31 |
to the native shell, wouldn't it be better to supply a Gentoo/FreeBSD |
32 |
baselayout? They don't have to be completely independent; smart use of |
33 |
the vcs would allow you to share scripts between baselayout branches, |
34 |
with specific variants where it makes a difference. |
35 |
|
36 |
> 3) What's the cost of *not* changing away from bash? |
37 |
> I would say that bash is the best shell around in terms of features |
38 |
> and ease of use, however that is not without cost. That cost is new |
39 |
> bash versions consistently breaking baselayout, ebuilds and configure |
40 |
> files. |
41 |
|
42 |
w.r.t new bash versions, we should certainly be conservative in marking |
43 |
new versions stable. It's worth noting the breakage isn't always |
44 |
100% the fault of bash. The recent problem with '=~' and quoting for |
45 |
example is down to glibc behaving differently to everyone else's libc |
46 |
when it comes to accepting quoted characters for the regex interfaces |
47 |
(a point where the POSIX standard is open to interpretation). |
48 |
|
49 |
> 4) Size. |
50 |
> Because bash has all these nice features it's large, hence unsuitable |
51 |
> for low memory or low disk space environments. |
52 |
|
53 |
But you only get one bash text image in memory at any one time (~825k). |
54 |
So space isn't a real issue, except on small-memory systems. |
55 |
|
56 |
> 5) I'm *just* talking about config files here. |
57 |
> If users want to run bash, that's fine and I won't stop them. They can |
58 |
> also use bash in their init script if they so wish as I plan to |
59 |
> support something like so |
60 |
> |
61 |
> depend() { |
62 |
> shell bash |
63 |
> } |
64 |
|
65 |
Making that sort of requirement explicit is a good idea. I wouldn't use |
66 |
'depend()', as in init scripts it's quite cleanly only to do with the |
67 |
order of services. You could make it an option to runscript: |
68 |
|
69 |
#!/bin/runscript --shell=/bin/bash |
70 |
|
71 |
or something along those lines - the shebang is clearly all about how |
72 |
the script is executed, and the shell used falls nicely into that. |
73 |
|
74 |
> And voila, problem solved. Of course, that's just an idea I just had. |
75 |
> However, I also think that baselayout provided services should not |
76 |
> require bash for the above reasons, hence the need for a new config. |
77 |
|
78 |
I think the argument for conf.d files is better than that for init.d |
79 |
scripts; you could have multiple baselayout setups that share conf.d |
80 |
file formats. |
81 |
|
82 |
-- |
83 |
Kevin F. Quinn |