Comment 0 for bug 1381792

Revision history for this message
Removed by request (removed3425744) wrote :

I'm using Ubuntu 14.10 dev with bash 4.3-11ubuntu1 and if stdout is redirected to a file and stderr is redirected to stdout the order isn't correct anymore. I have written a testcase to demonstrate the problem:

#include <stdio.h>

int main()
{
 short unsigned i;

 for(i = 0; i < 1024; ++i)
 {
  fprintf(stdout, "stdout\n");
  fprintf(stderr, "stderr\n");
 }
 return 0;
}

The code needs to be compiled with gcc for example as "gcc -Wall -pedantic -o test test.c". On executing "./test > test.log 2>&1" I would normally expect that the lines "stdout" and "stderr" are alternating with each other but I'm seeing a few hundred lines "stderr" and the a few hundred lines "stdout" and so on. Interestingly on every try I'm also seeing on line 1171 "sstderr" and on line 1610 "tdout" (these both lines seems to got mixed up).