GNU bug report logs -
#20733
coreutils build problem
Previous Next
Reported by: Paul Eggert <eggert <at> cs.ucla.edu>
Date: Thu, 4 Jun 2015 19:18:02 UTC
Severity: normal
Done: Paul Eggert <eggert <at> cs.ucla.edu>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
On 2015-06-04 13:34 -0600, Eric Blake wrote:
> [adding autoconf]
>
> On 06/04/2015 01:17 PM, Paul Eggert wrote:
> >
> > On 06/04/2015 09:41 AM, Michael Felt wrote:
> >> GEN src/coreutils.h
> >> /bin/sh: 0403-057 Syntax error at line 1 : `;' is not expected.
> >
>
> > Port to POSIX shell, which doesn't allow 'for i in ; do ...'.
>
> Actually, POSIX _does_ allow for missing words between 'in' and the
> terminator (; or newline) before 'do' (whether by a word that expands to
> nothing, or by omission of words), requiring that the body of the for
> statement is skipped in that case:
>
> http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_09_04
>
> But it is also true that older shells did not always follow this rule,
> so you are indeed better off always supplying at least one word that
> won't be expanded into nothingness.
>
> Hmmm, I thought that autoconf would document it as a portability
> pitfall, but I don't see it under 'for' in this link:
>
> https://www.gnu.org/software/autoconf/manual/autoconf.html#Limitations-of-Builtins
Yikes!
Some questions:
Do these problematic shells properly handle:
for arg
do
...
done
when $# is 0?
If so, can we use the following as a workaround?
set x words-that-might-expand-to-nothing; shift
for arg
do
...
done
I suppose that might be hard to do in this /particular/ case, as it
looks like the error is coming from a make rule. The Autoconf manual
quite emphatically says to avoid 'for arg; do ...' by using a newline
instead of a semicolon, a feat which is not easily done in make rules.
Cheers,
--
Nick Bowler, Elliptic Technologies (http://www.elliptictech.com/)
This bug report was last modified 10 years and 48 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.