bug-autoconf
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: bug#20733: coreutils build problem


From: Nick Bowler
Subject: Re: bug#20733: coreutils build problem
Date: Thu, 4 Jun 2015 16:17:18 -0400
User-agent: Mutt/1.5.23 (2014-03-12)

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/)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]