On 07/20/2010 03:05 PM, Paul Eggert wrote:
> If this guess is right, the following (untested) patch
> might fix the problem.  The basic idea is to open the
> fifo just once for reading and once for writing in the
> parent, so that no child needs to open a fifo and no
> child is left behind.

> 
> --- general.m4        2010-07-20 11:12:58.055141603 -0700
> +++ /tmp/general.m4   2010-07-20 13:59:28.607141344 -0700
> @@ -959,7 +959,8 @@ export PATH
>  
>  # Setting up the FDs.
>  m4_define([AS_MESSAGE_LOG_FD], [5])
> -m4_define([AT_JOB_FIFO_FD], [6])
> +m4_define([AT_JOB_INFIFO_FD], [6])
> +m4_define([AT_JOB_OUTFIFO_FD], [7])
>  [#] AS_MESSAGE_LOG_FD is the log file.  Not to be overwritten if `-d'.
>  if $at_debug_p; then
>    at_suite_log=/dev/null
> @@ -1366,6 +1367,9 @@ dnl cause changed test semantics; e.g.,
>    at_joblist=`AS_ECHO([" $at_groups_all "]) | \
>      sed 's/\( '$at_jobs'\) .*/\1/'`
>  
> +  exec AT_JOB_INFIFO_FD<"$at_job_fifo"

Won't work - opening a fifo for just reads blocks the shell until
someone else comes along and opens it for writes...

> +  exec AT_JOB_OUTFIFO_FD>"$at_job_fifo"

...and since we're blocked on the first line, the second line is never
reached.

Opening with AT_JOB_FIFO_FD<>fifo avoids blocking, but that's not
portable according to POSIX (and indeed fails miserably on cygwin).

-- 
Eric Blake   [email protected]    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to