autoconf-patches
[Top][All Lists]
Advanced

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

Zsh bugs: workaround in Autotest


From: Noah Misch
Subject: Zsh bugs: workaround in Autotest
Date: Sun, 6 May 2007 15:43:24 -0700
User-agent: Mutt/1.5.9i

Zsh has a bug in its evaluation of patterns that causes an infinite loop in
Autotest test suites.  This patch documents the problem and works around it.  I
also document another aspect of ${1+"$@"} in Zsh that affected Libtool.

Okay to apply?

2007-05-05  Noah Misch  <address@hidden>

        * lib/autotest/general.m4 (AT_INIT): Remove at_format.
        (_AT_NORMALIZE_TEST_GROUP_NUMBER): Compute pattern here.
        * doc/autoconf.texi ($@, case): Document Zsh limitations.

diff -Nurp -X dontdiff ac-clean/doc/autoconf.texi ac-zshwrapup/doc/autoconf.texi
--- ac-clean/doc/autoconf.texi  2007-05-05 00:39:14.000000000 -0400
+++ ac-zshwrapup/doc/autoconf.texi      2007-05-05 17:59:10.000000000 -0400
@@ -11600,6 +11600,10 @@ One workaround relies on Zsh's ``global 
 test "address@hidden@}" = set && alias -g 'address@hidden"$@@"@}'='"$@@"'
 @end example
 
+Zsh only recognizes this alias when a shell word matches it exactly;
address@hidden"foo"address@hidden"$@@"@}} remains subject to word splitting.  
Since this
+case always yields at least one shell word, use plain @samp{"$@@"}.
+
 A more conservative workaround is to avoid @samp{"$@@"} if it is
 possible that there may be no positional arguments.  For example,
 instead of:
@@ -12358,6 +12362,16 @@ esac
 but the @code{(} in this example is not portable to many Bourne
 shell implementations.  It can be omitted safely.
 
+Zsh handles pattern fragments derived from parameter expansions or
+command substitutions as though quoted:
+
address@hidden
+$ pat=\?; case aa in ?$pat) echo match;; esac
+$ pat=\?; case a? in ?$pat) echo match;; esac
+match
address@hidden example
+
address@hidden
 Because of a bug in its @code{fnmatch}, Bash fails to properly
 handle backslashes in character classes:
 
diff -Nurp -X dontdiff ac-clean/lib/autotest/general.m4 
ac-zshwrapup/lib/autotest/general.m4
--- ac-clean/lib/autotest/general.m4    2007-05-05 00:39:14.000000000 -0400
+++ ac-zshwrapup/lib/autotest/general.m4        2007-05-06 18:33:26.000000000 
-0400
@@ -154,12 +154,12 @@ m4_define([AT_LINE],
 # all the other test group numbers.
 m4_define([_AT_NORMALIZE_TEST_GROUP_NUMBER],
 [
-  while :; do
+  eval 'while :; do
     case $$1 in #(
-    $at_format*) break;;
+    '"$at_format"'*) break;;
     esac
     $1=0$$1
-  done
+  done'
 ])
 
 # _AT_CREATE_DEBUGGING_SCRIPT




reply via email to

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