[Slackbuilds-users] Patch proposal to remove bashisms from some scripts
miorimmax at gmail.com
Tue Nov 2 13:11:38 UTC 2010
On Tue, Nov 2, 2010 at 7:29 AM, B Watson <yalhcru at gmail.com> wrote:
> On 11/2/10, Ben Mendis <dragonwisard at gmail.com> wrote:
>> it is perfectly acceptable to specify 'bash' for you script instead.
> It is? I'd always assumed that the "follow our templates whenever
> possible" rule meant the #!/bin/sh (from the template) is required... If
> it's allowed to say #!/bin/bash, I'll do that for all my future
Unless we're talking about using either /bin/bash or /bin/sh, the
problem that I see with this is that it would open the precedence to
accept submissions of scripts using other shells like csh and zsh,
that could be a problem for the people that review the scripts, as
they'd have to learn the particularities of other shells - it could
slow down the process of review->approval considerably.
> Maybe the admins could make a note of it on the submissions page, or
> even change the template to start with #!/bin/bash (is there any reason
> not to do this? My opinion is there's not, but I'm just a luser...)
> Am not advocating mass-updating existing slackbuilds to change the
> shebang line, mind. Just the template. Maybe with a comment saying
> "do not change to #!/bin/sh unless you've actually tested your script
> with at least ash and ksh"?
I like the idea of updating the template. A note saying "you should
run these slackbuilds with bash" would be fine too. The current FAQ
and HOWTO assumes that the user know that Slackware assumes that
/bin/sh is a symlink to bash, that's a lot of assumptions if you ask
> Pretty much a separate (possibly off-topic) question here: why would
> anyone even care to use ash for /bin/sh on a build host? On an embedded
> system it makes sense, but on the dev box where you build its packages?
Why not? It doesn't matters if my /bin/sh is maxsownsh, bash or ash,
the shebang denotes that the script is compatible with the bourne
shell and, as long as my shell is compatible with it, it should run
just fine. ;)
My motivation to change the shell was because a co-worker, which uses
Debian Sid, has the same hardware that I do and his notebook runs our
sh-compatible scripts considerably faster than mine.
We compared configurations/optimizations and did a quite exhaustive
research on gnu.bash.bug looking for performance regressions. Then, I
changed the shebang of these scripts to use /bin/ash and, mind you,
the same thing that took 16.702 seconds using bash as /bin/sh took
6.803 with ash and pretty much the same happens to every script that
As I can't change every shebang or run the scripts using
"lightandfastsh script.sh", I did exactly what the others did in their
respective computers: changed my /bin/sh to a shell other than bash.
BTW, I don't have a "build host" - If the box that is building is slow
or if I just need more processing power, I use distcc.
More information about the SlackBuilds-users