[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] Describe a Solaris /bin/sh bug w.r.t. for loops.
From: |
Ralf Wildenhues |
Subject: |
Re: [PATCH] Describe a Solaris /bin/sh bug w.r.t. for loops. |
Date: |
Sun, 4 Jul 2010 20:50:22 +0200 |
User-agent: |
Mutt/1.5.20 (2010-04-22) |
Hi Eric, Stefano,
* Eric Blake wrote on Fri, Jul 02, 2010 at 06:37:31PM CEST:
> 2010-07-02 Stefano Lattarini <stefano.lattarini AT gmail.com>
> - Eric Blake <address@hidden>
> + and Eric Blake <address@hidden>
>
> Describe a Solaris /bin/sh bug w.r.t. for loops.
> * doc/autoconf.texi (Limitations of Shell Builtins) <for>:
> Document a bug of the 'for' builtin in Solaris /bin/sh, w.r.t.
> tokens seeming variable assignment in the list of arguments.
> - Report and final patch by Stefano Lattarini, useful suggestions
> - by Eric Blake.
Almost perfect. ;-)
I'm pushing the following patch to fix the issues of this that I found
in Autoconf. I didn't find any in Automake or Libtool, at least not
with a simple git grep.
Cheers,
Ralf
Fix testsuite to not trigger Solaris sh for bug.
* tests/torture.at (Torturing config.status)
(Substitute a 2000-byte string)
(Substitute and define special characters)
(Substitute a newline): Quote first argument in for list so
that it does not look like an assignment.
diff --git a/tests/torture.at b/tests/torture.at
index 27405b7..5f13874 100644
--- a/tests/torture.at
+++ b/tests/torture.at
@@ -684,8 +684,9 @@ AC_OUTPUT
AT_CHECK_AUTOCONF
AT_CHECK_AUTOHEADER
-# Check both awk and the result of AC_PROG_AWK
-for awk_arg in FOO= AWK=awk; do
+# Check both awk and the result of AC_PROG_AWK.
+# Quote the first word in the for list for Solaris sh.
+for awk_arg in "FOO=" AWK=awk; do
AT_CHECK_CONFIGURE([$awk_arg])
# Checking that AC_DEFINE worked properly.
@@ -800,7 +801,8 @@ EOF
AT_CHECK_AUTOCONF
# Check both awk and the result of AC_PROG_AWK
-for awk_arg in Foo= AWK=awk; do
+# Quote the first word in the for list for Solaris sh.
+for awk_arg in "Foo=" AWK=awk; do
AT_CHECK_CONFIGURE([$awk_arg])
AT_CHECK([cat Foo], 0, m4_for([n], 1, 100,, ....................)
)
@@ -910,7 +912,8 @@ AC_CONFIG_FILES([Foo Zardoz])]])
AT_CHECK_AUTOCONF
AT_CHECK_AUTOHEADER
# Check both awk and the result of AC_PROG_AWK
-for awk_arg in FOO= AWK=awk; do
+# Quote the first word in the for list for Solaris sh.
+for awk_arg in "FOO=" AWK=awk; do
AT_CHECK_CONFIGURE([$awk_arg])
AT_CHECK([cat Foo], 0, [[X*'[]+ ", & &`\($foo \& \\& \\\& \\\\& \ \\ \\\ !
@foo@ @baz@@address@hidden stray @ and more@@bla
@@ -975,7 +978,8 @@ x' >expout
AT_CHECK_AUTOCONF
# Check both awk and the result of AC_PROG_AWK
-for awk_arg in FOO= AWK=awk; do
+# Quote the first word in the for list for Solaris sh.
+for awk_arg in "FOO=" AWK=awk; do
AT_CHECK_CONFIGURE([$awk_arg])
AT_CHECK([cat Foo], 0, [expout])
done