On Dec 25 16:39, Ken Brown wrote: > I've noticed a difference between Cygwin and Linux involving named pipes. I > don't know if this a bug or simply a difference. > > Consider the following two scripts: > > $ cat fifo1.sh > #!/bin/sh > set -x > rm -f foo > mkfifo foo > exec 7>foo > echo blah > foo > > $ cat fifo2.sh > #!/bin/sh > set -x > read bar < foo > echo $bar > > I run fifo1.sh in Terminal 1 and get the following on both Cygwin and Linux: > > [Terminal 1] > $ ./fifo1.sh > + rm -f foo > + mkfifo foo > + exec > > The call to echo in the next line blocks, because foo has not yet been > opened for reading. Now I run fifo2.sh in Terminal 2. On Linux, the "read" > in fifo2.sh unblocks fifo1.sh, and I see the following: > > [Terminal 1, Linux] > $ ./fifo1.sh > + rm -f foo > + mkfifo foo > + exec > + echo blah > > [Terminal 2, Linux] > $ ./fifo2.sh > + read bar > + echo blah > blah > > On Cygwin, however, Terminal 1 remains blocked, and Terminal 2 is blocked > when it tries to read: > > [Terminal 2, Cygwin] > $ ./fifo2.sh > + read bar > > The problem disappears if I remove the line "exec 7>foo" from fifo1.sh. The > problem also disappears if I leave that line in, but change the last line to > "echo blah >&7".
Very tricky problem. The FIFO code falls over its own feet trying to handle more than one writer (exec 7> is the first, echo blah is the second writer). Sigh. This code needs a thorough rewrite... Corinna -- Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Maintainer cygwin AT cygwin DOT com Red Hat
signature.asc
Description: PGP signature