]> git.ipfire.org Git - thirdparty/automake.git/commitdiff
tests: drop support for older Zsh shells
authorStefano Lattarini <stefano.lattarini@gmail.com>
Sat, 23 Jun 2012 09:16:08 +0000 (11:16 +0200)
committerStefano Lattarini <stefano.lattarini@gmail.com>
Sat, 23 Jun 2012 10:58:37 +0000 (12:58 +0200)
* defs-static.in: Here.  The fact that such support has been broken for
almost a year (only fixed by today's commit 'v1.12.1-57-gf1e0300'),
causing no bug reports from anyone, shows that such support is not truly
warranted.  And it will get in the way of future improvements in the
handling of the exit trap (because bugs in older Zsh versions will
prevent some of our planned improvements).  So just drop it.
* t/README: Remove obsolete advice for working around bugs in older
versions of Zsh; instead, indicate version 4.3 is the oldest Zsh now
supported.

Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
defs-static.in
t/README

index a9024860364cabc2ea166d096e9fcf3f9c5bc19b..da5dcffdef6c1fe9136f444840c277f6939a3b18 100644 (file)
@@ -31,35 +31,22 @@ DUALCASE=1; export DUALCASE # for MKS sh
 if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
   emulate sh
   NULLCMD=:
-  # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
-  # is contrary to our usage.  Disable this feature.
-  alias -g '${1+"$@"}'='"$@"'
   setopt NO_GLOB_SUBST
-  # If Zsh is not started directly in Bourne-compatibility mode, it has
-  # some incompatibilities in the handling of $0 that conflict with
-  # our usage: i.e., $0 inside a file sourced with the '.' builtin is
-  # temporarily set to the name of the sourced file.
-  # Work around this when possible, otherwise abort the script.
+  # If Zsh is not started directly in POSIX-compatibility mode, it has some
+  # incompatibilities in the handling of $0 that conflict with our usage;
+  # i.e., $0 inside a file sourced with the '.' builtin is temporarily set
+  # to the name of the sourced file.  Work around that.
   # Note that a bug in some versions of Zsh prevents us from resetting $0
   # in a sourced script, so the use of $argv0.  For more info see:
-  #  <http://www.zsh.org/mla/workers/2009/msg01140.html>
-  # Note: the apparently useless 'eval' below are needed by at least
-  # dash 0.5.2, to prevent it from bailing out with an error like
-  # "Syntax error: Bad substitution"
-  if eval '[[ "$0" = *."tap" || "$0" = *."sh" ]]'; then
-    # Good, FUNCTION_ARGZERO option was already off when this file was
-    # sourced.  Thus we've nothing to do.
-    argv0=$0
-  elif eval 'test -n "${functrace[-1]}"'; then
-    # FUNCTION_ARGZERO option was on, but we have a easy workaround.
-    eval 'argv0=${functrace[-1]%:*}'
-  else
-    # Give up.
-    echo "$0: cannot determine the path of running test script" >&2
-    echo "$0: test was running with Zsh version $ZSH_VERSION" >&2
-    echo "$0: did you enable the NO_FUNCTION_ARGZERO option?" >&2
+  #   <http://www.zsh.org/mla/workers/2009/msg01140.html>
+  # The apparently useless 'eval' here is needed by at least dash 0.5.2,
+  # to prevent it from bailing out with an error like:
+  #   "Syntax error: Bad substitution".
+  eval 'argv0=${functrace[-1]%:*}' && test -f "$argv0" || {
+    echo "Cannot determine the path of running test script." >&2
+    echo "Your Zsh (version $ZSH_VERSION) is probably too old." >&2
     exit 99
-  fi
+  }
 else
   argv0=$0
   # Avoid command substitution failure, for Tru64 sh -e and instspc*.test.
index 3f56400f2fd8c354a0fb17a9f15fb781640d0118..43f7b713ba1aca0a1e28ca8f8ee7bbcd3f17535a 100644 (file)
--- a/t/README
+++ b/t/README
@@ -105,23 +105,10 @@ Supported shells
   to run the test(s) through the makefile test driver.
 
   The test scripts are written with portability in mind, so that they
-  should run with any decent Bourne-compatible shell.
-
-  However, some care must be used with Zsh, since, when not directly
-  started in Bourne-compatibility mode, it has some incompatibilities
-  in the handling of $0 which conflict with our usage.  Our testsuite
-  can automatically work around these incompatibilities when a version
-  4.3 or later of Zsh is used, but unfortunately not when an older
-  version of Zsh is used.  Thus, if you want to run a test script, say
-  'foo.sh', with Zsh 4.2, you *can't* simply do "zsh foo.sh", but
-  you *must* resort to:
-
-    AM_TESTS_REEXEC=no zsh -o no_function_argzero foo.sh
-
-  Note that this problem does not occur if Zsh is executed through
-  a symlink with a basename of 'sh', since in that case Zsh starts
-  in Bourne compatibility mode.  So you should be perfectly safe
-  when /bin/sh is Zsh, even a it's version < 4.3.
+  should run with any decent Bourne-compatible shell.  However, it is
+  worth nothing that older versions of Zsh (pre-4.3) exhibited several
+  bugs and incompatibilities with our uses, and are thus not supported
+  for running Automake's test scripts.
 
 
 Reporting failures