On Sun, Sep 09, 2007 at 08:44:25PM +0200, Pierre-Philippe Coupard wrote: [...] > - akula, my bleeding edge box, is a Debian-unstable box upgraded yesterday > sept 8, 2007. It runs linux-2.6.17.7, libc6-2.6.1 > > - kilo, my most up-to-date box where bash still seems to behave properly > with regard to that problem, is also a Debian-unstable box, upgraded on may > 1st, 2007. It runs linux2.6.18, libc6-2.5 > > On both boxes, I tried Stephane's test line with bash-3.1.17 and > bash-2.05b: > > On both boxes, with bash-3.1.17, I get the "bash: line 0: echo: write > error: Broken pipe" message, and no error message with bash-2.05b. > > On akula, both versions of bash generate a file with 2 lines. > On kilo, both version of bash generate a correct file with 1 line. [...]
Would seem to be down to the version of glibc where the behavior of fflush() would have changed. But I don't explain why Andreas doesn't get the same behavior as me with the same version of glibc. I tried on a glibc 2.3.4 and with the C file I see only "b" in the "a" file. Same thing with Solaris and HPUX with the system's libc. So that would confirm that the behavior changed in the glibc (probably somewhere after 2.5). And the problem may be more of a glibc problem than a bash problem. I've checked SUSv3 and it doesn't say wether the output buffer should be emptied after a non-successful fflush() (as older glibc seemed to be doing but as newer ones seem no longer to be doing). -- Stéphane