+2007-09-27 Stepan Kasal <kasal@ucw.cz>
+ and Eric Blake <ebb9@byu.net>
+
+ 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 <ebb9@byu.net>
Squelch changeword in m4sugar.
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
@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
$ @kbd{exec 5>t}
$ @kbd{./descrips}
$ @kbd{cat t}
-$
hello
+$
@end example
@noindent
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.
# 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.
# 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
# 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)