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

Re: D03 test hang on cygwin with latest sources



On Thu, 20 Nov 2008 21:12:44 -0800
Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> On Nov 20, 11:08pm, Vin Shelton wrote:
> }
> } Peter -
> } 
> } It looks like something bad happened with your process redirection
> } changes.  After building from the latest CVS sources, I ran the
> } testsuite and got a hang in D03.  A ZTST_verbose=2 trace follows.
> } 
> } The last time I built the shell on this platform, 2008-10-12, this
> } test passed.
> 
> I'm not sure historical success means anything here, because there
> previously was no test of >(...) except in the context of > >(...).

Right, the behaviour isn't new.  It seems as if the subprocess is
reading EOF from the input.

% foo() { print $1; print hello >$1; [[ -e $1 ]] || print Ouch! }
% foo >(sleep 1; read foo || print Failed)
/proc/self/fd/12
Failed

I don't understand why it would do that, given the order in which things
apparently happen (there's roughly a second gap between the messages, as
you'd expect).  Waiting the other way round, I get

% foo() { print $1; (sleep 1; print hello) >$1; [[ -e $1 ]] || print Ouch! }
% foo >(read foo || print Failed)
/proc/self/fd/12
foo: write error: bad file descriptor
Failed

I printed $ERRNO and it's zero.  Note that the read in the subprocess only
fails *after* the attempt to write fails.

It's also not clear to me why this is so different from "print hello | read
foo", which works, except to note that pipes in this case exchange a sync
word.

-- 
Peter Stephenson <pws@xxxxxxx>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070



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