Hello Paul, Eric,

* Paul Eggert wrote on Tue, Jul 20, 2010 at 08:39:45PM CEST:
> System call writes and reads should be atomic, but there's no requirement
> that the shell must implement "echo token" as an atomic write of 6 bytes.
> If the shell sometimes implements "echo token" as multiple writes, that alone
> would explain the problem.

Good point, but wouldn't that be at least a QoI issue for the shell?

> I suggest replacing "echo token" with "echo ''", so that a token
> is always a single newline byte.  This may have nothing to do with
> your problem, but it should be done anyway, to make the script
> more portable.  And if bash or the kernel does have bugs with respect to
> atomicity, it will make the script less liable to run into the bugs.

OK; that may still be more than one byte on w32 systems, but it's an
improvement nonetheless.

Eric, does this improve tests on your system?

Thanks,
Ralf

2010-07-20  Ralf Wildenhues  <ralf.wildenh...@gmx.de>

        autotest: use one-byte tokens for more reliable job control.
        * lib/autotest/general.m4 (AT_JOB_FIFO_FD): Pass a single
        newline.
        Suggested by Paul Eggert, bug report by Eric Blake.

diff --git a/lib/autotest/general.m4 b/lib/autotest/general.m4
index e27d601..f4df429 100644
--- a/lib/autotest/general.m4
+++ b/lib/autotest/general.m4
@@ -1386,7 +1386,7 @@ dnl optimize away the _AT_CHECK subshell, so normalize 
here.
 dnl Ignore PIPE signals that stem from writing back the token.
            trap "" PIPE
            echo stop > "$at_stop_file"
-           echo token >&AT_JOB_FIFO_FD
+           echo >&AT_JOB_FIFO_FD
 dnl Do not reraise the default PIPE handler.
 dnl It wreaks havoc with ksh, see above.
 dnl        trap - 13
@@ -1401,7 +1401,7 @@ dnl           kill -13 $$
        at_failed=:
       fi
       at_fn_group_postprocess
-      echo token >&AT_JOB_FIFO_FD
+      echo >&AT_JOB_FIFO_FD
     ) &
     $at_job_control_off
     if $at_first; then

Reply via email to