Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Multio / process substitution bug



So I did a little more investigation on this ...

On Wed, May 18, 2011 at 7:43 AM, Bart Schaefer
<schaefer@xxxxxxxxxxxxxxxx> wrote:
> Given the following which you probably recognize from zsh-users:
>
> alias -g file_err='>(sed s/^/file_err:/)'
> alias -g file_out='>(sed s/^/file_out:/)'
> alias -g file_mix='>(sed s/^/file_mix:/)'
> outanderr() { print STDOUT; print -u2 STDERR }
>
> The following command:
>
> torch% outanderr 1>&1 >file_out 2>&2 2>file_err >& file_mix
> STDOUT
> file_out:STDOUT
> STDERR
> file_err:STDERR
>
> is now hung forever waiting in signal_suspend() for the file_mix process
> to exit.  Keyboard signals are disabled so the only way to interrupt it
> is to kill it from another shell.
>

Turns out everything is hung because the multio pseudo-"cat" loops
(forked in exec.c:closemn()) still have any previous such loops'
standard input open, so none of them are seeing end-of-file in order
to exit.

This is in spite of the fact that the last thing closemn() does before
it begins looping is to call closeallelse().  I haven't figured out
why that fails to close the descriptors opened for other multios, but
that's the root of the problem.



Messages sorted by: Reverse Date, Date, Thread, Author