]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
Close job control fd before running tests.
authorEric Blake <eblake@redhat.com>
Wed, 21 Jul 2010 04:11:14 +0000 (22:11 -0600)
committerEric Blake <eblake@redhat.com>
Wed, 21 Jul 2010 04:11:14 +0000 (22:11 -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 <eblake@redhat.com>
ChangeLog
doc/autoconf.texi
lib/autotest/general.m4

index e9146c3186bbd8858f0b4ace3664eff822926dd5..2544b76281f206cc06f46c1d0867e39418ecc3ed 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2010-07-20  Eric Blake  <eblake@redhat.com>
+
+       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  <eggert@cs.ucla.edu>
        and Eric Blake  <eblake@redhat.com>
 
index c47d510339830ce019966143dedf4b5b74a90332..c3a8714ac436b58aa8a759a9b4f61e0e002aaed0 100644 (file)
 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.
 
 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
+@samp{@var{n}<&-} or @samp{@var{n}>&-} 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.
index f328ef4da374cabc156cd4f2de9e73e3bc6b319b..4acdb9d2039747647749830980d09219368c1d03 100644 (file)
@@ -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.