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

Re: Several reasons why debian should not use bash for /bin/sh



cdulrich@ucdavis.edu (Chris Ulrich) writes:

> Compatibility: People are tempted to (and in fact do) write scripts that
>        use bash specific extensions when explicitly calling /bin/sh.  

Most developers seem to react to bug reports about this by changing the script
to /bin/bash. While obviously "correct", I think policy should discourage this
over using purely Posix sh features when possible.

There are two reasons for this, the obvious one being that the script can be
run on non-Debian machines. However the non-obvious one is, imho, even more
important: Bash extensions are not protected from future API changes by a
standard the way POSIX features are.

Bash maintainers can at their whim, introduce api changes to their extensions,
possibly breaking any scripts that rely on them. They've done this in the
past, and there's no particularly reason they shouldn't do it. These features
are not specified by anything and it's entirely up to their judgement whether
the advantages of the new api outweigh the disadvantage of breaking
compatibility. 

Also, the Bash-specific features are not necessarily as well specified as
POSIX. Depending on such features means that you're never really sure if your
script doesn't have some subtle bug. If you depend only on POSIX behaviour
then you can report any problems as bash bugs.

To a degree i'm exaggerating. The situation is no worse than any other
non-standard api from any other package. But since we do have a good standard,
and I don't see how any of the bash extensions are really essential* I think
it would be a good idea to avoid them and stick with the standard.


A little bit of reality check: Ash and Bash are both reasonably close to
POSIX. Bash has some particularly blatant non-POSIXisms whereas ash's
non-POSIXisms are more subtle and obscure. I don't know about pdksh, but
a hint, any "-posix" flag or the ilk is a very worrisome sign, the standard
behaviour has to be the default, anything else is worthless.

I would like to see ash made the default shell for slink while it's in
unstable. This would help avoid people accidentally using bashisms and would
have a lot more developers checking for bugs.

greg


[*] With the possible extension of the localised strings. That's nice.



--  
To UNSUBSCRIBE, email to debian-devel-request@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org


Reply to: