On Feb 8 22:25, Tom Honermann wrote: > The following program demonstrates the problem. > [...] > Here is where things go bananas. If the program is run with stdout > initially redirected to a pipe, then the stderr output from the native > Windows program ends up overwriting the stdout output from the two > calls to echo: > > $ ./test | cat > $ cat out > The syntax of this command is: > > NET > [ ACCOUNTS | COMPUTER | CONFIG | CONTINUE | FILE | GROUP | HELP | > HELPMSG | LOCALGROUP | PAUSE | SESSION | SHARE | START | > STATISTICS | STOP | TIME | USE | USER | VIEW ] > > Note that the lines containing "first" and "second" are now absent in > the file.
Thanks for the testcase. I tracked this down to a bug when calling native (non-Cygwin) apps. If the descriptor is in O_APPEND mode, we have to set the file offset to EOF before calling native apps. However, this only worked reliably for the first descriptor in O_APPEND mode, but only by chance for subsequent descriptors in O_APPEND mode. Your example code with the extra pipe to `cat' triggered the misbehaviour. I fixed that in git master: https://sourceware.org/git/?p=newlib-cygwin.git;a=commitdiff;h=0be0b8f0335e This will be in the 3.0.0 release. I just uploaded new developer snapshots to https://cygwin.com/snapshots/ You only need to replace the Cygwin DLL for testing. Please give it a try. Thanks, Corinna -- Corinna Vinschen Cygwin Maintainer
signature.asc
Description: PGP signature