[patch] Use /bin/bash instead of /bin/sh for bashisms

Jan-Benedict Glaw jbglaw at lug-owl.de
Tue Jan 3 09:47:20 UTC 2006


On Tue, 2006-01-03 04:30:51 -0500, John Kelly <jakelly at shtc.net> wrote:
> On Tue, 03 Jan 2006 07:46:01 +0100, Jan-Benedict Glaw
> <jbglaw at lug-owl.de> wrote:
> >> On Mon, 02 Jan 2006 10:49:27 +0100, Natanael Copa <mlists at tanael.org>
> >> >It didn't work with csh and tcsh.
> >> 
> >> That's irrelevant.
> >> 
> >> http://www.faqs.org/faqs/unix-faq/shell/csh-whynot/
> >
> >Well, the main point is that the scripts are just used to build the
> >library. Reading POSIX, you *can* *not* rely on /bin/sh being a POSIX
> >shell.
> 
> A POSIX shell is standard practice for building software.

Right. But you should make sure that you actually *use* it.

Makefile:
~~~~~~~~~
----------------------
target: deps
	./extra/some/script.sh
----------------------

...is just wrong, if script.sh starts with "#!/bin/sh". It might be
executed using /bin/sh, which need not be POSIX compliant. Correct
would be to either:

----------------------
target: deps
	sh ./extra/some/script.sh
----------------------

or (hoping that the operating system supports "#!" (no _need_ to
support that, btw. !)) alternatively, you'd try "#!/usr/bin/env sh",
which should pick up the first "sh" from $PATH (which would be POSIX
compliant).

The evil thing about POSIX is that there are some dark spots which
you'd better not look at. Even a rusty old Solaris 8 (with some
packages installed and $PATH properly set) is mostly POSIX compliant
(don't cry about the spots that aren't, you won't ever touch them),
but it still probably won't work like you'd expect it from a GNU/Linux
system :-)

MfG, JBG

-- 
Jan-Benedict Glaw       jbglaw at lug-owl.de    . +49-172-7608481             _ O _
"Eine Freie Meinung in  einem Freien Kopf    | Gegen Zensur | Gegen Krieg  _ _ O
 für einen Freien Staat voll Freier Bürger"  | im Internet! |   im Irak!   O O O
ret = do_actions((curr | FREE_SPEECH) & ~(NEW_COPYRIGHT_LAW | DRM | TCPA));
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://lists.busybox.net/pipermail/uclibc/attachments/20060103/e01a2e12/attachment-0002.pgp 


More information about the uClibc mailing list