Re: [PATCH/RFC] eradicate bashisms in scripts/patch-kernel

From: Herbert Xu
Date: Thu Nov 01 2007 - 22:02:22 EST


On Thu, Nov 01, 2007 at 04:08:57PM -0700, Randy Dunlap wrote:
>
> > - replace non-standard bash string parsing by sed expression
> > (is the sed syntax ok? correct? strict enough?)
>
> I think that this is the part that bothers me. I can't find
> anything at
> http://www.opengroup.org/onlinepubs/000095399/utilities/xcu_chap02.html
> that says that this:
> EXTRAVER=${EXTRAVER%%[[:punct:]]*}
>
> is invalid or even optional syntax. OTOH, it does list such syntax,

This is POSIX-compliant and has worked with dash from the very
start.

> > About the missing $ signs:
> > http://www.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html#tag_02_14
> > says:
> > "If the shell variable x contains a value that forms a valid integer
> > constant, then the arithmetic expansions
> > "$((x))" and "$(($x))" shall return the same value."
> >
> > Hmm, well, seems dash doesn't... (syntax error).
> > Thus I still needed to add the $ signs despite opengroup.org specifying
> > it differently.
>
> Herbert?

Using variables without dollar signs in arithmetic expansion was
only added to dash very recently. So please please talk to your
distribution maker to update their dash packages and it will work
correctly.

This usage is compliant with the most recent revision of POSIX
while earlier ones did not specifically require this (due to
the fact that assignment support was not required either).

Cheers,
--
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@xxxxxxxxxxxxxxxxxxx>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/