Configuration Information [Automatically generated, do not change]: Machine: x86_64 OS: linux-gnu Compiler: gcc -I/home/abuild/rpmbuild/BUILD/bash-4.2 -L/home/abuild/rpmbuild/BUILD/bash-4.2/../readline-6.2 Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64' -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-suse-linux-gnu' -DCONF_VENDOR='suse' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' -DSHELL -DHAVE_CONFIG_H -I. -I. -I./include -I./lib -fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -g -D_GNU_SOURCE -DRECYCLES_PIDS -Wall -g -Wuninitialized -Wextra -Wno-unprototyped-calls -Wno-switch-enum -Wno-unused-variable -Wno-unused-parameter -ftree-loop-linear -pipe -DBNC382214=0 -fprofile-use uname output: Linux omnfr121 4.5.0-4.g3d86af7-default #1 SMP PREEMPT Fri Mar 18 13:03:45 UTC 2016 (3d86af7) x86_64 x86_64 x86_64 GNU/Linux Machine Type: x86_64-suse-linux-gnu
Bash Version: 4.2 Patch Level: 47 Release Status: release Description: ordering of printed lines changes when merging stdin/stdout and redirecting Repeat-By: #include <stdio.h> int main() { printf("hallo %d\n",__LINE__); fprintf(stderr,"hallo %d\n",__LINE__); printf("hallo %d\n",__LINE__); fprintf(stderr,"hallo %d\n",__LINE__); printf("hallo %d\n",__LINE__); return 0; } compile: gcc prg.c then: ( ./a.out 2>&1 ) hallo 5 hallo 6 hallo 7 hallo 8 hallo 9 ( ./a.out 2>&1 ) >xx cat xx hallo 6 hallo 8 hallo 5 hallo 7 hallo 9 note: the same happens with ./a.out >xx 2>&1 cat xx hallo 6 hallo 8 hallo 5 hallo 7 hallo 9 I am not sure if that is an intended behavior. at least it is annoying when trying to analyze bugs. If this is intended behavior it would be nice if that would be included into the manual (i have found no hint, maybe wrong keyword ?) and a way to fix that. re, wh