[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] Close job control fd before running tests.
From: |
Eric Blake |
Subject: |
[PATCH] Close job control fd before running tests. |
Date: |
Tue, 20 Jul 2010 22:14:45 -0600 |
* doc/autoconf.texi (File Descriptors): Clarify limitations.
* lib/autotest/general.m4 (AT_CLEANUP): Avoid leaking job control
fifo fd to user tests.
(AT_INIT): Delete comment, now that close is done elsewhere.
Suggested by Ralf Wildenhues.
Signed-off-by: Eric Blake <address@hidden>
---
This should be pretty safe.
ChangeLog | 9 +++++++++
doc/autoconf.texi | 8 +++++++-
lib/autotest/general.m4 | 4 ++--
3 files changed, 18 insertions(+), 3 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index e9146c3..2544b76 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2010-07-20 Eric Blake <address@hidden>
+
+ Close job control fd before running tests.
+ * doc/autoconf.texi (File Descriptors): Clarify limitations.
+ * lib/autotest/general.m4 (AT_CLEANUP): Avoid leaking job control
+ fifo fd to user tests.
+ (AT_INIT): Delete comment, now that close is done elsewhere.
+ Suggested by Ralf Wildenhues.
+
2010-07-20 Paul Eggert <address@hidden>
and Eric Blake <address@hidden>
diff --git a/doc/autoconf.texi b/doc/autoconf.texi
index c47d510..c3a8714 100644
--- a/doc/autoconf.texi
+++ b/doc/autoconf.texi
@@ -15006,7 +15006,7 @@ File Descriptors
Within the process which runs the @samp{descrips} script, file
descriptor 5 is closed.
-Don't rely on redirection to a closed file descriptor to cause an
+Don't rely on duplicating a closed file descriptor to cause an
error. With Solaris @command{/bin/sh}, when the redirection fails, the
output goes to the original file descriptor.
@@ -15019,6 +15019,12 @@ File Descriptors
0
@end example
+Fortunately, an attempt to close an already closed file descriptor will
+portably succeed. Likewise, it is safe to use either style of
address@hidden@var{n}<&-} or @address@hidden>&-} for closing a file descriptor,
+even if it doesn't match the read/write mode that the file descriptor
+was opened with.
+
DOS variants cannot rename or remove open files, such as in
@samp{mv foo bar >foo} or @samp{rm foo >foo}, even though this is
perfectly portable among Posix hosts.
diff --git a/lib/autotest/general.m4 b/lib/autotest/general.m4
index f328ef4..4acdb9d 100644
--- a/lib/autotest/general.m4
+++ b/lib/autotest/general.m4
@@ -1405,7 +1405,7 @@ dnl kill -13 $$
at_fn_group_prepare
if cd "$at_group_dir" &&
at_fn_test $at_group &&
- . "$at_test_source" [#] AT_JOB_FIFO_OUT_FD>&-
+ . "$at_test_source"
then :; else
AS_WARN([unable to parse test group: $at_group])
at_failed=:
@@ -1917,7 +1917,7 @@ echo "# -*- compilation -*-"
>> "$at_group_log"
m4_undivert([TEST_SCRIPT])dnl Insert the code here
set +x
$at_times_p && times >"$at_times_file"
-) AS_MESSAGE_LOG_FD>&1 2>&1 | eval $at_tee_pipe
+) AS_MESSAGE_LOG_FD>&1 2>&1 AT_JOB_FIFO_OUT_FD>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
[#AT_STOP_]AT_ordinal
m4_divert_pop([TEST_GROUPS])dnl Back to KILL.
--
1.7.1.1
- [PATCH] Close job control fd before running tests.,
Eric Blake <=