dash

Rocco Stanzione grasshopper at linuxkungfu.org
Fri Sep 15 20:06:56 BST 2006


On Thursday 14 September 2006 14:45, Scott James Remnant wrote:
> On Thu, 2006-09-14 at 14:06 -0500, Rocco Stanzione wrote:
> > 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)
>
> Err, this isn't valid POSIX shell...
>
> > http://www.opengroup.org/onlinepubs/000095399/utilities/test.html
>
> As cited by the URL you gave.
>
>
> "test -a" is a very definite bashism for "if file exists".  The correct
> POSIX for that is -e.

I've just noticed a new bug filed:
https://launchpad.net/distros/ubuntu/+source/flashplugin-nonfree/+bug/60612

Another #!/bin/sh script that fails with dash.  By itself, it's not a big 
deal.  We can fix the script in our repositories.  Let me be more 
conservative in making this claim this time, but from what I can tell from
http://www.opengroup.org/onlinepubs/000095399/idx/shell.html
and
http://www.opengroup.org/onlinepubs/000095399/functions/wait.html
to which the first link refers, returning -1 is good POSIX behavior which dash 
cannot handle.

To quote,

"Internally, for purposes of deciding whether a command exits with a non-zero 
exit status, the shell shall recognize the entire status value retrieved for 
the command by the equivalent of the wait() function WEXITSTATUS macro (as 
defined in the System Interfaces volume of IEEE Std 1003.1-2001). When 
reporting the exit status with the special parameter '?', the shell shall 
report the full eight bits of exit status available."

and in the documentation for wait(),
"If wait() or waitpid() returns due to the delivery of a signal to the calling 
process, -1 shall be returned and errno set to [EINTR]."

Rocco



More information about the ubuntu-devel mailing list