LWN.net Logo

De-bashing Debian

De-bashing Debian

Posted May 27, 2010 17:10 UTC (Thu) by iabervon (subscriber, #722)
Parent article: De-bashing Debian

It seems to me that the common flaw with these scripts is not that they're using bash features, but that they're running /bin/sh. If they ran the executable that's supposed to support the features they need, and didn't make the assumption that any shell that supports all of the POSIX features also supports bash features, they would still work.

Of course, it may be worth giving up bash features for implementation efficiency, but changing the used dialect to a better one is a separate issue from making sure to have support for the dialect you're using.


(Log in to post comments)

De-bashing Debian

Posted May 29, 2010 18:42 UTC (Sat) by giraffedata (subscriber, #1954) [Link]

If they ran the executable that's supposed to support the features they need, and didn't make the assumption that any shell that supports all of the POSIX features also supports bash features,

I don't think the programs are making that assumption. What they're assuming is that those Bash features are POSIX. And it's hard to do otherwise. A great deal of software engineering is done by trial and error, not the more laborious reading of specs. If your trials happen to use Bash, there's no visible error.

Gcc has the -ansi option to support trial and error development of ANSI-only C programs. Why doesn't Bash have a similar thing?

I write #!/bin/sh at the top of my shell programs to express my desire that it work with any POSIX shell, but in fact I always test with Bash and the program often doesn't work with anything else.

De-bashing Debian

Posted Jun 1, 2010 21:39 UTC (Tue) by lab (subscriber, #51153) [Link]

Gcc has the -ansi option to support trial and error development of ANSI-only C programs. Why doesn't Bash have a similar thing?
man bash:
--posix Change the behavior of bash where the default operation differs from the POSIX standard to match the standard (posix mode).

De-bashing Debian

Posted Jun 2, 2010 1:42 UTC (Wed) by giraffedata (subscriber, #1954) [Link]

Gcc has the -ansi option to support trial and error development of ANSI-only C programs. Why doesn't Bash have a similar thing?
man bash: --posix Change the behavior of bash where the default operation differs from the POSIX standard to match the standard (posix mode).

That's not what that is. It affects behaviors where something is valid in both POSIX and Bash but means something different, but it does not affect behavior where something is valid in Bash and not valid at all in POSIX. I.e. it doesn't force a program to fail just because it exploits a bashism. That's what gcc -ansi is.

Copyright © 2013, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds