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

Re: |& loses data (buffering bug?)



On 2004-02-13 15:00:16 +0000, Peter Stephenson wrote:
> On Fri, 13 Feb 2004 15:43:11 +0100
> Vincent Lefevre <vincent@xxxxxxxxxx> wrote:
> 
> > On 2004-02-13 14:33:59 +0000, Peter Stephenson wrote:
> > > Have you tried typing `F' in less? It could be the output is jerky
> > > and less hasn't actually read to the end of the file.
> > 
> > This isn't related to the problem. 
> 
> Well, it's certainly *related*, unless I'm really missing the point.  Do
> you mean the lines that are missing aren't at the end?

No, not at the end, just before or after the

cvs status: Examining o.alpha
cvs status: Examining o.linux
cvs status: Examining o.solaris
cvs status: Examining o.sunos
cvs status: Examining tests

block (that comes from stderr). And I have the same problem with grep
(see my example) -- but this may be normal in this case, as the output
may be fully buffered.

> > Anyway, I've tried and this doesn't solve anything, e.g.
> 
> I don't understand what this example means.  Where is the data missing here?

Some data from the "cvs status". The example with grep may be better
though (however I can no longer reproduce it).

> Can you get the same effect with e.g.
> 
>   perl -e 'open STDERR, ">&STDOUT";
>   open STDIN, "cvs status|";
> 
>   exec "less";'
> 
> which doesn't involve zsh at all?

It doesn't work either, but this is different: the stderr output is
completely missing.

I've done a "strace -f -o strace.out cvs status |& less" and I got:

[...]
===================================================================
File: zeta.c            Status: Up-to-date

   Working revision:    1.37
   Repository revision: 1.37    /CVS/spaces/mpfr/zeta.c,v
   Sticky Tag:          (none)
   Sticky Date:         (none)
   Sticky Options:      (none)

cvs status: Examining o.alpha
cvs status: Examining o.linux
cvs status: Examining o.solaris
cvs status: Examining o.sunos
cvs status: Examining tests

   Sticky Tag:          (none)
   Sticky Date:         (none)
   Sticky Options:      (none)

===================================================================
File: tsub.c            Status: Up-to-date

   Working revision:    1.40
   Repository revision: 1.40    /CVS/spaces/mpfr/tests/tsub.c,v
   Sticky Tag:          (none)
   Sticky Date:         (none)
   Sticky Options:      (none)
[...]

And strace.out contains:

[...]
4601  write(1, "\nFile: round_raw_generic.c\tStatu"..., 4096) = -1 EAGAIN (Resource temporarily unavailable)
4601  read(6,  <unfinished ...>
4622  <... select resumed> )            = 1 (in [5])
4622  read(5, "!\f0\366$\215\237\333IW\v3\177\5\251Rn\5\240\322\267X\373"..., 8192) = 736
4622  select(10, [5 6], [8], NULL, NULL) = 1 (out [8])
4622  write(8, "\242r\340\24\302\356\307\201.\34#5\361\230\222\276?\247"..., 300) = 300
4601  <... read resumed> "\242r\340\24\302\356\307\201.\34#5\361\230\222\276?\247"..., 4096) = 300
4622  select(10, [5 6], [], NULL, NULL <unfinished ...>
4601  write(1, "\n\n   Working revision:\t1.53\n   R"..., 4096) = -1 EAGAIN (Resource temporarily unavailable)
4601  read(6,  <unfinished ...>
4622  <... select resumed> )            = 1 (in [5])
4622  read(5, "\361\22V}jm\2\214\327jT\344LU\213\3241\365\6\375\312\032"..., 8192) = 832
4622  select(10, [5 6], [8], NULL, NULL) = 1 (out [8])
4622  write(8, "\242n\340\224\240\36.KF\262\301_\243\33b\251\321\301v\322"..., 334) = 334
4601  <... read resumed> "\242n\340\224\240\36.KF\262\301_\243\33b\251\321\301v\322"..., 4096) = 334
4622  select(10, [5 6], [], NULL, NULL <unfinished ...>
4601  write(1, "\n   Sticky Tag:\t\t(none)\n   Stick"..., 4096) = -1 EAGAIN (Resource temporarily unavailable)
4601  read(6,  <unfinished ...>
4622  <... select resumed> )            = 1 (in [5])
4622  read(5, "`\302\215\274p?\376s93[\367\20cJ\304Cj\343\f\273e\246\030"..., 8192) = 1104
4622  select(10, [5 6], [8], NULL, NULL) = 1 (out [8])
4622  write(8, "\242n\0A\23\17\5\223\26x\327\357bYZ\10\267\221&\241\3\0"..., 497) = 497
4601  <... read resumed> "\242n\0A\23\17\5\223\26x\327\357bYZ\10\267\221&\241\3\0"..., 4096) = 497
4622  select(10, [5 6], [], NULL, NULL <unfinished ...>
4601  write(1, "\n\n=============================="..., 1350) = 1350
4601  write(2, "cvs status: Examining o.alpha", 29) = 29
4601  write(2, "\n", 1)                 = 1
4601  write(2, "cvs status: Examining o.linux", 29) = 29
4601  write(2, "\n", 1)                 = 1
4601  write(2, "cvs status: Examining o.solaris", 31) = 31
4601  write(2, "\n", 1)                 = 1
4601  write(2, "cvs status: Examining o.sunos", 29) = 29
4601  write(2, "\n", 1)                 = 1
4601  write(2, "cvs status: Examining tests", 27) = 27
4601  write(2, "\n", 1)                 = 1
4601  read(6,  <unfinished ...>
4622  <... select resumed> )            = 1 (in [5])
4622  read(5, "\340X0MX[TaR!zP\\\300\20h\200\2g\231\270_\251\224\332y"..., 8192) = 688
4622  select(10, [5 6], [8], NULL, NULL) = 1 (out [8])
4622  write(8, "\242v \245 \355y$\243\32064\300?\301\7\224\307\334{\r\v"..., 267) = 267
4601  <... read resumed> "\242v \245 \355y$\243\32064\300?\301\7\224\307\334{\r\v"..., 4096) = 267
4622  select(10, [5 6], [], NULL, NULL <unfinished ...>
4601  write(1, "================================"..., 4096) = -1 EAGAIN (Resource temporarily unavailable)
4601  read(6,  <unfinished ...>
4622  <... select resumed> )            = 1 (in [5])
4622  read(5, "N\17$\370\230\207 \304\35\201\261c\333\240\265\21U\207"..., 8192) = 1504
4622  select(10, [5 6], [8], NULL, NULL) = 1 (out [8])
4622  write(8, "\242v\30e\244&gS0|K\346\10@I2\304^\232\4\21\0\0\0\377\377"..., 626) = 626
4601  <... read resumed> "\242v\30e\244&gS0|K\346\10@I2\304^\232\4\21\0\0\0\377\377"..., 4096) = 626
4622  select(10, [5 6], [], NULL, NULL <unfinished ...>
4601  write(1, "\n   Sticky Options:\t(none)\n\n===="..., 4096) = -1 EAGAIN (Resource temporarily unavailable)
[...]

With "strace -f -o strace2.out cvs status | cat", the write(1, ...)
calls return 4096 instead of -1.

-- 
Vincent Lefèvre <vincent@xxxxxxxxxx> - Web: <http://www.vinc17.org/> - 100%
validated (X)HTML - Acorn Risc PC, Yellow Pig 17, Championnat International
des Jeux Mathématiques et Logiques, TETRHEX, etc.
Work: CR INRIA - computer arithmetic / SPACES project at LORIA



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