[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[SCM] GNU Autoconf source repository branch, master, updated. v2.69-144-
From: |
Eric Blake |
Subject: |
[SCM] GNU Autoconf source repository branch, master, updated. v2.69-144-g51b89d1 |
Date: |
Thu, 04 Jun 2015 21:59:47 +0000 |
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Autoconf source repository".
http://git.sv.gnu.org/gitweb/?p=autoconf.git;a=commitdiff;h=51b89d1ccd9b3e4d7d89acc0390f8a297184ad96
The branch, master has been updated
via 51b89d1ccd9b3e4d7d89acc0390f8a297184ad96 (commit)
from 82ef7805faffa151e724aa76c245ec590d174580 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 51b89d1ccd9b3e4d7d89acc0390f8a297184ad96
Author: Eric Blake <address@hidden>
Date: Thu Jun 4 14:00:29 2015 -0600
doc: mention 'for' syntax issue on older shells
Based on a report by Michael Felt, via Paul Eggert on the
coreutils list.
* doc/autoconf.texi (Limitations of Builtins) <for>: Document
problem with 'for var in ;'.
Signed-off-by: Eric Blake <address@hidden>
-----------------------------------------------------------------------
Summary of changes:
doc/autoconf.texi | 36 ++++++++++++++++++++++++++++++++++++
1 files changed, 36 insertions(+), 0 deletions(-)
diff --git a/doc/autoconf.texi b/doc/autoconf.texi
index 8c4302d..9eac07b 100644
--- a/doc/autoconf.texi
+++ b/doc/autoconf.texi
@@ -17757,6 +17757,42 @@ But keep in mind that Zsh, even in Bourne shell
emulation mode, performs
word splitting on @address@hidden"$@@"@}}; see @ref{Shell Substitutions},
item @samp{$@@}, for more.
+Posix requires support for a @command{for} loop with no list after
address@hidden However, Solaris @command{/bin/sh} treats that as a syntax
+error. It is possible to work around this by providing any shell word
+that expands to nothing, or by ignoring an obvious sentinel.
+
address@hidden
+$ @kbd{/bin/sh -c 'for a in $empty; do echo hi; done'}
+$ @kbd{/bin/sh -c 'for a in ; do echo hi; done'}
+/bin/sh: syntax error at line 1: `;' unexpected
address@hidden example
+
+This syntax problem is most frequently encountered in code that goes
+through several layers of expansion, such as an m4 macro or makefile
+variable used as a list body, where the first layer of expansion (m4 or
+make) can end up expanding to nothing in the version handed to the
+shell. In the makefile context, one common workaround is to use a shell
+variable rather than a make variable as the source of the list.
+
address@hidden
+$ @kbd{cat Makefile}
+list =
+bad:
+ @@for arg in $(list); do echo $$arg; done
+good:
+ @@list='$(list)'; for arg in $$list; do echo $$arg; done
+$ @kbd{make bad 2&>1 | head -n1}
+sh: syntax error at line 1: `;' unexpected
+$ @kbd{make bad list='a b'}
+a
+b
+$ @kbd{make good}
+$ @kbd{make good list='a b'}
+a
+b
address@hidden example
+
In Solaris @command{/bin/sh}, when the list of arguments of a
@command{for} loop starts with @emph{unquoted} tokens looking like
variable assignments, the loop is not executed on those tokens:
hooks/post-receive
--
GNU Autoconf source repository
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [SCM] GNU Autoconf source repository branch, master, updated. v2.69-144-g51b89d1,
Eric Blake <=