* 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>
+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>
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.
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=:
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.