From: Stepan Kasal Date: Fri, 28 Sep 2007 03:09:18 +0000 (-0600) Subject: Autotest no longer caters to Ultrix redirection limitation. X-Git-Tag: v2.62~248 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=755596a7aeb47a7c34d67982ca566a8fd20c15b0;p=thirdparty%2Fautoconf.git Autotest no longer caters to Ultrix redirection limitation. * doc/autoconf.texi (Writing testsuite.at): Remove the limitation that the first parameter of AT_CHECK cannot contain redirection. (File Descriptors): Mention that Ultrix limitation is no longer a show-stopper in modern code. * tests/local.at (AT_CHECK_M4): Fix for cases when the fourth parameter is `stderr' or `experr'. Optimize if it was `ignore'. * lib/autotest/general.m4 (AT_CHECK): Update comment. --- diff --git a/ChangeLog b/ChangeLog index 8b443b0e..ea29d1bd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2007-09-27 Stepan Kasal + and Eric Blake + + Autotest no longer caters to Ultrix redirection limitation. + * doc/autoconf.texi (Writing testsuite.at): Remove the + limitation that the first parameter of AT_CHECK cannot + contain redirection. + (File Descriptors): Mention that Ultrix limitation is no longer a + show-stopper in modern code. + * tests/local.at (AT_CHECK_M4): Fix for cases when the fourth + parameter is `stderr' or `experr'. Optimize if it was `ignore'. + * lib/autotest/general.m4 (AT_CHECK): Update comment. + 2007-09-27 Eric Blake Squelch changeword in m4sugar. diff --git a/doc/autoconf.texi b/doc/autoconf.texi index 8d41f477..bd67ab19 100644 --- a/doc/autoconf.texi +++ b/doc/autoconf.texi @@ -11609,8 +11609,8 @@ escape, while @samp{: `cd /zorglub 2>/dev/null`} works properly. It is worth noting that Zsh (but not Ash nor Bash) makes it possible in assignments though: @samp{foo=`cd /zorglub` 2>/dev/null}. -Don't redirect the same file descriptor several times, as you are doomed -to failure under Ultrix. +When catering to old systems, don't redirect the same file descriptor +several times, as you are doomed to failure under Ultrix. @example ULTRIX V4.4 (Rev. 69) System #31: Thu Aug 10 19:42:23 GMT 1995 @@ -11625,7 +11625,8 @@ Ambiguous output redirect. @noindent In each case the expected result is of course @file{fullness} containing -@samp{matter} and @file{void} being empty. +@samp{matter} and @file{void} being empty. However, this bug is +probably not of practical concern to modern platforms. Don't rely on file descriptors 0, 1, and 2 remaining closed in a subsidiary program. If any of these descriptors is closed, the @@ -11647,8 +11648,8 @@ echo hello >&5 $ @kbd{exec 5>t} $ @kbd{./descrips} $ @kbd{cat t} -$ hello +$ @end example @noindent @@ -19107,8 +19108,13 @@ status 77, then the whole test group is skipped. Otherwise, if this test fails, run shell commands @var{run-if-fail} or, if this test passes, run shell commands @var{run-if-pass}. -The @var{commands} @emph{must not} redirect the standard output, nor the -standard error. +@c Previously, we had this: +@c The @var{commands} @emph{must not} redirect the standard output, nor the +@c standard error. +@c to prevent trigerring the double redirect bug on Ultrix, see +@c `File Descriptors'. This was too restricting, and Ultrix is pretty +@c much dead, so we dropped the limitation; the obvious workaround on +@c Ultrix is to use a working shell there. If @var{status}, or @var{stdout}, or @var{stderr} is @samp{ignore}, then the corresponding value is not checked. diff --git a/lib/autotest/general.m4 b/lib/autotest/general.m4 index b067d9f5..4be59a6a 100644 --- a/lib/autotest/general.m4 +++ b/lib/autotest/general.m4 @@ -1295,21 +1295,17 @@ $2[]_ATEOF # AT_CHECK([command], [], [stdout]) # # Some checks on `stdout' # -# This is an unfortunate limitation inherited from Ultrix which will not -# let you redirect several times the same FD (see the Autoconf documentation). -# If you use the `AT_CHECK([command >out])' be sure to get a test suite -# that will show spurious failures. -# -# You might wonder why not just use `ignore' and directly use stdout and -# stderr left by the test suite. Firstly because the names of these files -# is an internal detail, and secondly, because +# You might wonder why you can't just use `ignore', then directly use stdout +# and stderr left by the test suite: # # AT_CHECK([command], [], [ignore]) # AT_CHECK([check stdout]) # -# will use `stdout' both in input and output: undefined behavior would -# certainly result. That's why the test suite will save them in `at-stdout' -# and `at-stderr', and will provide you with `stdout' and `stderr'. +# If the test suite always captured data in the file `stdout', then the +# second command would be trying to read and write from the same file, with +# undefined behavior. Therefore, the test suite actually captures data in +# an internal file of a different name, and only creates `stdout' when +# explicitly requested. # # Any line of stderr starting with leading blanks and a `+' are filtered # out, since most shells when tracing include subshell traces in stderr. diff --git a/tests/local.at b/tests/local.at index 8f419fec..8a6bffde 100644 --- a/tests/local.at +++ b/tests/local.at @@ -1,6 +1,6 @@ # M4 macros used in building Autoconf test suites. -*- Autotest -*- -# Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software +# Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software # Foundation, Inc. # This program is free software: you can redistribute it and/or modify @@ -96,15 +96,15 @@ m4_define([AT_CHECK_PERL_SYNTAX], # remove the error code during normalization. # m4_define([AT_CHECK_M4], -[AT_CHECK([$1], [$2], [$3], m4_ifval([$4], [stderr])) -m4_ifval([$4], +[AT_CHECK([$1], [$2], [$3], m4_if([$4], [], [], [ignore], [ignore], [stderr])) +m4_if([$4], [], [], [ignore], [], [AT_CHECK([[sed 's/^[^:]*m4: *\([^:]*:\) *\([0-9][0-9]*: \)/m4:\1\2/ s/^\([^:]*:\) *\([0-9][0-9]*:\)[^:]*m4: /m4:\1\2 / s/^\(m4:[^:]*:[0-9][0-9]*: \)C\(annot open \)\([^`:]*\):/\1c\2`\3'\'':/ s/^autom4te: [^ ]*m4 /autom4te: m4 / s/^autom4te: [^ ]*m4\.exe /autom4te: m4 / s/ (E[A-Z]*)$// - ' stderr]], [0],[$4])]) + ' stderr >&2]], [0], [], [$4])]) ]) # AT_CHECK_AUTOM4TE(FLAGS, [EXIT-STATUS = 0], STDOUT, STDERR)