From 596644ca294922cc29a3f803f1226a9433e4af66 Mon Sep 17 00:00:00 2001 From: Eric Blake Date: Thu, 2 Jul 2009 07:17:43 -0600 Subject: [PATCH] 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. Signed-off-by: Eric Blake --- ChangeLog | 9 +++++++++ doc/autoconf.texi | 18 ++++++++++++++++++ tests/autotest.at | 13 ++++++++++--- 3 files changed, 37 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8f0b5ae0..4d5d5324 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2009-07-02 Eric Blake + + 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 (tiny change) Ralf Wildenhues diff --git a/doc/autoconf.texi b/doc/autoconf.texi index 5908bbb5..04e3b10c 100644 --- a/doc/autoconf.texi +++ b/doc/autoconf.texi @@ -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{!} diff --git a/tests/autotest.at b/tests/autotest.at index d86088c6..6f0bd1d5 100644 --- a/tests/autotest.at +++ b/tests/autotest.at @@ -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]) -- 2.47.2