[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Fix chdir-long.m4 caching
From: |
Eric Blake |
Subject: |
Re: Fix chdir-long.m4 caching |
Date: |
Thu, 27 Sep 2007 22:32:51 -0600 |
User-agent: |
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070728 Thunderbird/2.0.0.6 Mnenhy/0.7.5.666 |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
According to Stepan Kasal on 9/29/2006 7:48 AM:
> Hello Ralf,
Hello all, and digging up another oldie but goodie from my inbox.
>
> On Wed, Sep 27, 2006 at 09:09:00PM +0200, Ralf Wildenhues wrote:
>>> - ' stderr]], [0],[$4])])
>>> + ' stderr >&2]], [0], [], [$4])])
>> This triggers the multiple redirection bug on Ultrix (see
>> `(autoconf.info)File Descriptors'); I don't know if other, non-museum
>> systems are affected, too. But anyway we disallow it in the manual, so
>> iff we decide that this is ok now, then at least both those doc parts
>> need updates, too:
>>
>> | -- Macro: AT_CHECK (COMMANDS, [STATUS = `0'], [STDOUT = `'], [STDERR =
>> | `'], [RUN-IF-FAIL], [RUN-IF-PASS])
>> [...]
>> | The COMMANDS _must not_ redirect the standard output, nor the
>> | standard error.
>
> Why both of them have to be updated? There are far more consumers
> of Autoconf than of Autotest. I suggest to remove the limitation
> from AT_CHECK documentation only. Ultrix is rare these days, and
> people willing to run the generated testsuite there will have to use
> a working shell.
>
> What about the following patch?
>
> 2006-09-29 Stepan Kasal <address@hidden>
>
> * doc/autoconf.texi (Writing testsuite.at): Remove the
> limitation that the first parameter of AT_CHECK cannot
> contain redirection.
> * tests/local.at (AT_CHECK_M4): Fix for cases when the past
> parameter is `stderr' or `experr'.
>
> Stepan
>
Applied as follows:
- --
Don't work too hard, make some time for fun as well!
Eric Blake address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFG/IPz84KuGfSFAYARAoCiAJ93Nm1rj80kNYO5AjxEnGBK0EqDUwCg1pjc
UinR7PZfOZ6M/MPjv8DPquY=
=6obD
-----END PGP SIGNATURE-----
>From 755596a7aeb47a7c34d67982ca566a8fd20c15b0 Mon Sep 17 00:00:00 2001
From: Stepan Kasal <address@hidden>
Date: Thu, 27 Sep 2007 21:09:18 -0600
Subject: [PATCH] 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.
---
ChangeLog | 13 +++++++++++++
doc/autoconf.texi | 18 ++++++++++++------
lib/autotest/general.m4 | 18 +++++++-----------
tests/local.at | 8 ++++----
4 files changed, 36 insertions(+), 21 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 8b443b0..ea29d1b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2007-09-27 Stepan Kasal <address@hidden>
+ and Eric Blake <address@hidden>
+
+ 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 <address@hidden>
Squelch changeword in m4sugar.
diff --git a/doc/autoconf.texi b/doc/autoconf.texi
index 8d41f47..bd67ab1 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
address@hidden and @file{void} being empty.
address@hidden 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.
address@hidden Previously, we had this:
address@hidden The @var{commands} @emph{must not} redirect the standard
output, nor the
address@hidden standard error.
address@hidden to prevent trigerring the double redirect bug on Ultrix, see
address@hidden `File Descriptors'. This was too restricting, and Ultrix is
pretty
address@hidden much dead, so we dropped the limitation; the obvious workaround
on
address@hidden 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 b067d9f..4be59a6 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 8f419fe..8a6bffd 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)
--
1.5.3.2
- Re: Fix chdir-long.m4 caching,
Eric Blake <=