]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
Skip test on shells that can't catch syntax failure.
authorEric Blake <ebb9@byu.net>
Thu, 2 Jul 2009 13:17:43 +0000 (07:17 -0600)
committerEric Blake <ebb9@byu.net>
Thu, 2 Jul 2009 13:17:43 +0000 (07:17 -0600)
* tests/autotest.at (Syntax error): Skip test if shell aborts on
syntax error (AIX ksh88) or doesn't detect it (zsh).
* doc/autoconf.texi (Limitations of Builtins) <.>: Mention these
limitations.
Reported by Ralf Wildenhues.

Signed-off-by: Eric Blake <ebb9@byu.net>
ChangeLog
doc/autoconf.texi
tests/autotest.at

index 8f0b5ae0b9b5910816d3ad52f9545d3508551c03..4d5d5324f1234dd334f74949096f4313059e1460 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2009-07-02  Eric Blake  <ebb9@byu.net>
+
+       Skip test on shells that can't catch syntax failure.
+       * tests/autotest.at (Syntax error): Skip test if shell aborts on
+       syntax error (AIX ksh88) or doesn't detect it (zsh).
+       * doc/autoconf.texi (Limitations of Builtins) <.>: Mention these
+       limitations.
+       Reported by Ralf Wildenhues.
+
 2009-06-30  Jan Madzik  <jmadzik@gmail.com>  (tiny change)
            Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
 
index 5908bbb50780b43bbfcfc2e6800ee948ed63a490..04e3b10cf85c15c3c6c525465be25e05602557e0 100644 (file)
@@ -15483,6 +15483,24 @@ to this @env{PATH} search, even though Posix forbids it.  So if you want
 to use @command{.} on a file @file{foo} in the current directory, you
 must use @samp{. ./foo}.
 
+Not all shells gracefully handle syntax errors within a sourced file.
+On one extreme, some non-interactive shells abort the entire script.  On
+the other, @command{zsh} 4.3.10 has a bug where it fails to react to the
+syntax error.
+
+@example
+$ @kbd{echo 'fi' > syntax}
+$ @kbd{bash -c '. ./syntax; echo $?'}
+./syntax: line 1: syntax error near unexpected token `fi'
+./syntax: line 1: `fi'
+1
+$ @kbd{ash -c '. ./syntax; echo $?'}
+./syntax: 1: Syntax error: "fi" unexpected
+$ @kbd{zsh -c '. ./syntax; echo $?'}
+./syntax:1: parse error near `fi'
+0
+@end example
+
 @item @command{!}
 @c --------------
 @prindex @command{!}
index d86088c6f09ed68f1a0398dc9eb26af231811e5d..6f0bd1d5ad80741586bedd6a229c9689a2e3dfb5 100644 (file)
@@ -271,9 +271,16 @@ AT_CHECK_AT_TEST([Syntax error],
    AT_CLEANUP
    AT_SETUP([another test])
    AT_CHECK([:])],
-  [], [1], [], [stderr], [],
-  [AT_CHECK([grep "unable to parse test group: 2" stderr], [0], [ignore])
-   AT_CHECK([$CONFIG_SHELL ./micro-suite 1 3], [0], [ignore])])
+  [], [0], [], [], [],
+  [dnl Until we can find a way to avoid catastrophic failure (ash) or
+   dnl lack of failure (zsh), skip the rest of this test on such shells.
+   echo 'if' > syntax
+   AT_CHECK([${CONFIG_SHELL-$SHELL} -c 'case `. ./syntax; echo $?` in
+                 0|"") exit 77;;
+               esac'], [0], [ignore], [ignore])
+   AT_CHECK([$CONFIG_SHELL ./micro-suite], [1], [ignore], [stderr])
+   AT_CHECK([grep "unable to parse test group: 2" stderr], [0], [ignore])],
+  [1 3])
 
 AT_CHECK_AT_TEST([errexit],
   [AT_CHECK([false])