builtin echo command redirection misbehaves in detached scripts when terminal is closed

2007-09-09 Thread Pierre-Philippe Coupard
Configuration Information [Automatically generated, do not change]: Machine: i486 OS: linux-gnu Compiler: gcc Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='i486' -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i486-pc-linux-gnu' -DCONF_VENDOR='pc' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='

Re: builtin echo command redirection misbehaves in detached scripts when terminal is closed

2007-09-09 Thread Stephane Chazelas
On Sun, Sep 09, 2007 at 04:58:23PM +0200, Pierre-Philippe Coupard wrote: [...] >while [ 1 ];do > echo Test1 > echo Test2 >> file.txt > sleep 1 >done > >As expected, when this script is run in the background (&), the > console >slowly fills

Re: builtin echo command redirection misbehaves in detached scripts when terminal is closed

2007-09-09 Thread Andreas Schwab
Stephane Chazelas <[EMAIL PROTECTED]> writes: > Bonjour Pierre-Philippe, > > can be reproduced with 3.2.25 and with: > > bash -c 'trap "" PIPE; sleep 1; echo a; echo b > a' | : I get this: $ bash -c 'trap "" PIPE; sleep 1; echo a; echo b > a' | : bash: line 0: echo: write error: Broken pipe and

Re: builtin echo command redirection misbehaves in detached scripts when terminal is closed

2007-09-09 Thread Stephane Chazelas
On Sun, Sep 09, 2007 at 07:36:52PM +0200, Andreas Schwab wrote: > Stephane Chazelas <[EMAIL PROTECTED]> writes: > > > Bonjour Pierre-Philippe, > > > > can be reproduced with 3.2.25 and with: > > > > bash -c 'trap "" PIPE; sleep 1; echo a; echo b > a' | : > > I get this: > > $ bash -c 'trap "" PI

Re: builtin echo command redirection misbehaves in detached scripts when terminal is closed

2007-09-09 Thread Stephane Chazelas
On Sun, Sep 09, 2007 at 07:10:59PM +0100, Stephane Chazelas wrote: [...] > What OS and version of glibc? I do get the error message but I > get both a and b in the file. > > That was on Linux, glibc 2.6.1. [...] Actually, bash -c 'echo a; echo b > a' >&- is enough for me to reproduce the proble

Re: builtin echo command redirection misbehaves in detached scripts when terminal is closed

2007-09-09 Thread Pierre-Philippe Coupard
Andreas Schwab wrote: I get this: $ bash -c 'trap "" PIPE; sleep 1; echo a; echo b > a' | : bash: line 0: echo: write error: Broken pipe and the file contains only one line. Andreas. I did more tests, and this is what I came up with: - akula, my bleeding edge box, is a Debian-unstable box

Re: builtin echo command redirection misbehaves in detached scripts when terminal is closed

2007-09-09 Thread Andreas Schwab
Stephane Chazelas <[EMAIL PROTECTED]> writes: > That was on Linux, glibc 2.6.1. Same. Andreas. -- Andreas Schwab, SuSE Labs, [EMAIL PROTECTED] SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany PGP key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now fo

Re: builtin echo command redirection misbehaves in detached scripts when terminal is closed

2007-09-09 Thread Stephane Chazelas
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 regar

Re: builtin echo command redirection misbehaves in detached scripts when terminal is closed

2007-09-09 Thread Andreas Schwab
Stephane Chazelas <[EMAIL PROTECTED]> writes: > On Sun, Sep 09, 2007 at 07:10:59PM +0100, Stephane Chazelas wrote: > [...] >> What OS and version of glibc? I do get the error message but I >> get both a and b in the file. >> >> That was on Linux, glibc 2.6.1. > [...] > > Actually, > > bash -c 'ec

Re: builtin echo command redirection misbehaves in detached scripts when terminal is closed

2007-09-09 Thread Stephane Chazelas
On Sun, Sep 09, 2007 at 10:08:14PM +0200, Andreas Schwab wrote: > Stephane Chazelas <[EMAIL PROTECTED]> writes: > > > On Sun, Sep 09, 2007 at 07:10:59PM +0100, Stephane Chazelas wrote: > > [...] > >> What OS and version of glibc? I do get the error message but I > >> get both a and b in the file.

Re: builtin echo command redirection misbehaves in detached scripts when terminal is closed

2007-09-09 Thread Pierre-Philippe Coupard
The change is far from trivial or harmless, if it was intended. I had to rebuild a custom server I run in a hurry because it was flooding an IRC channel with log lines a backend bash script sent to stderr. And I can think of plenty of ways to trash files with this bug. Anyway, thanks a lot Sté

Re: builtin echo command redirection misbehaves in detached scripts when terminal is closed

2007-09-09 Thread Eric Blake
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 According to Stephane Chazelas on 9/9/2007 11:17 AM: > can be reproduced with 3.2.25 and with: > > bash -c 'trap "" PIPE; sleep 1; echo a; echo b > a' | : > > It seems to be down to the usage of stdio. Indeed. I raised this very bug several months

Re: Bug#429021: builtin echo command redirection misbehaves in detached scripts when terminal is closed

2007-09-09 Thread Aurelien Jarno
Stephane Chazelas a écrit : > On Sun, Sep 09, 2007 at 10:08:14PM +0200, Andreas Schwab wrote: >> Stephane Chazelas <[EMAIL PROTECTED]> writes: >> >>> On Sun, Sep 09, 2007 at 07:10:59PM +0100, Stephane Chazelas wrote: >>> [...] What OS and version of glibc? I do get the error message but I