Rocco Stanzione grasshopper at linuxkungfu.org
Thu Sep 14 20:06:09 BST 2006

I didn't catch the dialog that resulted in /bin/sh being linked to dash, and 
I've only found a wiki page and a spec (which seem to be identical) briefly 
stating the rationale.  I don't like it, and I'd like to say why.

I've come across a half-dozen or so 3rd-party scripts whose shebang lines say 
#!/bin/sh that don't work with dash.  The problems usually involve tests 
and/or subshell execution.  A number of patches have already gone into 
scripts exhibiting these problems in Ubuntu packages, and some packages 
(limewire recently reared its head) that are not available in Ubuntu of 
course cannot be patched and will likely be difficult for many to diagnose.

I kept quiet, though, figuring too many wheels had already started turning in 
that direction, until today when I tried to build iptables.  When I 
ran "make", the first line of output was:

[: 1: /usr/src/linux/include/asm: unexpected operator

caused by the line:

ifeq ($(shell [ -a $(KERNEL_DIR)/include/asm ] && echo YES), YES)

in the Makefile.
That's a pretty standard shell test, that also fails on the shell:

trappist at monk:~$ dash
$ [ -a /usr/src/linux/include/asm ] && echo YES
[: 1: /usr/src/linux/include/asm: unexpected operator

Other similar examples also fail:

$ if [ -a /usr/src/linux/include/asm ]; then echo YES; fi
[: 4: /usr/src/linux/include/asm: unexpected operator

The above URL shows other examples that should work with a POSIX-compliant 
shell and do not.  As far as I know, none of the scripts failing to work with 
dash have failed because the scripts were not POSIX-compliant, but because 
dash isn't.



More information about the ubuntu-devel mailing list