Bug#627025: perl: data loss in output when both stdout and stderr are redirected to a pipe

Vincent Lefevre vincent at vinc17.net
Tue May 17 13:07:06 UTC 2011


The problem is still reproducible with:

  strace -f -o strace.out ./svn2log bigrep-wc 2>&1 | less

The strace output shows interesting things:

[...]
2109  write(5, "06\n2607\n2608\n2609\n2610\n2611\n2612"..., 16384) = 16384
2108  <... read resumed> "06\n2607\n2608\n2609\n2610\n2611\n2612"..., 4096) = 4096
2109  read(3,  <unfinished ...>
2108  write(1, "93\n2994\n2995\n2996\n2997\n2998\n2999"..., 4096 <unfinished ...>
2109  <... read resumed> "\306q\22\221X7\317p\201<\265\222\277\270;:O\225\37\272\212P\212*]q\4\337\370\262s\201"..., 8192) = 8192
2108  <... write resumed> )             = -1 EAGAIN (Resource temporarily unavailable)
2109  select(7, [3 4], [3], NULL, NULL <unfinished ...>
2108  write(1, "\n1026\n1027\n1028\n1029\n1030\n1031\n1"..., 4096 <unfinished ...>
2109  <... select resumed> )            = 2 (in [3], out [3])
2108  <... write resumed> )             = -1 EAGAIN (Resource temporarily unavailable)
2109  read(3,  <unfinished ...>
2108  write(1, "1845\n1846\n1847\n1848\n1849\n1850\n18"..., 4096 <unfinished ...>
2109  <... read resumed> "\236k\205\214QuEe>\236\312\204@\204\205\264p\t\353y\5Zln\212s\245V\241Nqf"..., 8192) = 8192
2108  <... write resumed> )             = -1 EAGAIN (Resource temporarily unavailable)
2109  write(3, "v\337\365\300\245\225/\343\336D\0177\35\302\350\276\220(4\266x\314\3769\344\270}c\340\365\315\351"..., 48 <unfinished ...>
2108  read(6,  <unfinished ...>
2109  <... write resumed> )             = 48
2108  <... read resumed> "6\n537\n538\n539\n540\n541\n542\n543\n54"..., 4096) = 4096
2109  select(7, [3 4], [5], NULL, NULL <unfinished ...>
2108  read(6,  <unfinished ...>
2109  <... select resumed> )            = 2 (in [3], out [5])
2108  <... read resumed> "48\n1449\n1450\n1451\n1452\n1453\n1454"..., 4096) = 4096
2109  write(5, "113\n114\n115\n116\n117\n118\n119\n120\n"..., 16384 <unfinished ...>
2108  read(6,  <unfinished ...>
2109  <... write resumed> )             = 16384
2108  <... read resumed> "7\n2268\n2269\n2270\n2271\n2272\n2273\n"..., 4096) = 4096
2109  read(3,  <unfinished ...>
2108  write(1, "664\n2665\n2666\n2667\n2668\n2669\n267"..., 4096 <unfinished ...>
2109  <... read resumed> "\267F\31I\225l\323\365\351\346\357\226\f\3038r\247e\257:\2\207\27O\366\237\rV\7\347\1F"..., 8192) = 8192
2108  <... write resumed> )             = -1 EAGAIN (Resource temporarily unavailable)
2109  select(7, [3 4], [], NULL, NULL <unfinished ...>
2108  write(1, "\n621\n622\n623\n624\n625\n626\n627\n628"..., 4096 <unfinished ...>
2109  <... select resumed> )            = 1 (in [3])
2108  <... write resumed> )             = -1 EAGAIN (Resource temporarily unavailable)
2109  read(3,  <unfinished ...>
2108  write(1, "\n1516\n1517\n1518\n1519\n1520\n1521\n1"..., 4096 <unfinished ...>
2109  <... read resumed> "\4\311\375z{\341\312~H\20\321g\341_u1\253\2376*\177\263P}\242:\177\354X\205\7\340"..., 8192) = 8192
2108  <... write resumed> )             = -1 EAGAIN (Resource temporarily unavailable)
2109  select(7, [3 4], [5], NULL, NULL <unfinished ...>
2108  read(6,  <unfinished ...>
2109  <... select resumed> )            = 2 (in [3], out [5])
2108  <... read resumed> "113\n114\n115\n116\n117\n118\n119\n120\n"..., 4096) = 4096
2109  write(5, "3\n714\n715\n716\n717\n718\n719\n720\n72"..., 16384 <unfinished ...>
2108  read(6,  <unfinished ...>
2109  <... write resumed> )             = 16384
2108  <... read resumed> "9\n1110\n1111\n1112\n1113\n1114\n1115\n"..., 4096) = 4096
[...]

The write errors from the Perl script could explain the problem.

-- 
Vincent Lefèvre <vincent at vinc17.net> - Web: <http://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / Arénaire project (LIP, ENS-Lyon)






More information about the Perl-maintainers mailing list