Re: BASH Redirect (STDOUT & STDERR) Syncing
michael <linux@networkingnewsletter.org.uk> writes:
>> > Actually, I've noticed this for many things I've run from the cmd line
>> > in Debian (and have noticed it not happening for other Unices)... the
>> > only thing that springs to mind at the moment is output from 'make'
>> > having std err and std out well out of sync.... any ideas what might be
>> > going on here? (Debian GNU/Linux, 2.4.27-1-686-smp, Sarge apt updates)
>>
>> Hmmm, not sure I can confirm this. Especially with command line tools
>> it's common practice to do line buffering when output is directed to a
>> terminal and block buffering otherwise, e.g. in pipes or when output
>> is redirected into a file.
>>
>> Especially regarding block buffering, if a program doesn't take extra
>> measures it's buffering strategy will usually be governed by the
>> standard library, i.e. glibc. And in that case the only possible
>> reason for differing behavior on different platforms could only be
>> some config option given to glibc, presumably during compilation time,
>> targeting e.g. the buffer size. This may be possible, but at least I'm
>> not aware of Debian doing something special in that regard and can't
>> myself really say that Sarge behaves any different than, say, FC3.
>>
>> Maybe somebody else knows more ?
>>
>> Regards, Bruno.
>>
>
> okay, a quick try to recreate this failed, so let me try another time
> when less busy. it may be that I did something silly like a parallel
> compile in which case I'd expect a bit of a mess in the make-log for
> make -j 2 > make-log 2>&1
> sort of thing
>
> NB: I was comparing outputs with not just other Linux dists but IRIX too
Sure, but if you didn't link (GNU?) make against glibc on IRIX either,
but rather against the native libc, differences in output buffering
shouldn't be that surprising I guess. That is, if output streams
default buffer sizes weren't part of any standard, and I think they
aren't, it'd be left to the implementor to choose some value.
Let us know though if you can reproduce behavior which may be
considered irregular. Always nice to investigate these kind of things
...
Regards, Bruno.
Reply to: