Re: Strange behaviour on 'read' from a pipe

2012-04-02 Thread Lluís Batlle i Rossell
On Mon, Apr 02, 2012 at 03:29:33PM -0400, Greg Wooledge wrote: > On Mon, Apr 02, 2012 at 08:46:12PM +0200, Lluís Batlle i Rossell wrote: > > #!/bin/sh > > You're running this in sh? But reporting it as a bug in bash? In that case, sh points to bash. Sorry for the confusion I could have caused.

Re: Strange behaviour on 'read' from a pipe

2012-04-02 Thread Greg Wooledge
On Mon, Apr 02, 2012 at 08:46:12PM +0200, Lluís Batlle i Rossell wrote: > #!/bin/sh You're running this in sh? But reporting it as a bug in bash? > PIPE=/tmp/pipe > > rm -f $PIPE > mkfifo $PIPE > set -x > > spawn() { > sleep 0.1 > echo DONE > $PIPE > } > > spawn & > > while true; do

Re: Strange behaviour on 'read' from a pipe

2012-04-02 Thread Lluís Batlle i Rossell
On Mon, Apr 02, 2012 at 04:39:19PM +0200, Lluís Batlle i Rossell wrote: > Trying to reproduce the race, I got rid of 'sleep', and expected this to never > hang. But it hangs where I try. Should I submit this to LKML maybe? > > I think it should not hang ever, but maybe I forecast something bad. >

Re: Strange behaviour on 'read' from a pipe

2012-04-02 Thread Lluís Batlle i Rossell
On Sun, Apr 01, 2012 at 06:27:46PM -0400, Chet Ramey wrote: > On 4/1/12 1:02 PM, Lluís Batlle i Rossell wrote: > > On Sun, Apr 01, 2012 at 11:06:22AM -0400, Chet Ramey wrote: > >> On 4/1/12 5:53 AM, Andreas Schwab wrote: > >> > It looks like a simple race condition. I suspect that the schedul

Re: Strange behaviour on 'read' from a pipe

2012-04-02 Thread Lluís Batlle i Rossell
On Sun, Apr 01, 2012 at 06:27:46PM -0400, Chet Ramey wrote: > On 4/1/12 1:02 PM, Lluís Batlle i Rossell wrote: > > On Sun, Apr 01, 2012 at 11:06:22AM -0400, Chet Ramey wrote: > >> On 4/1/12 5:53 AM, Andreas Schwab wrote: > >> > It looks like a simple race condition. I suspect that the schedul

Re: Strange behaviour on 'read' from a pipe

2012-04-01 Thread Chet Ramey
On 4/1/12 1:02 PM, Lluís Batlle i Rossell wrote: > On Sun, Apr 01, 2012 at 11:06:22AM -0400, Chet Ramey wrote: >> On 4/1/12 5:53 AM, Andreas Schwab wrote: >> It looks like a simple race condition. I suspect that the scheduler arranges things so that the child process ends up exiting betw

Re: Strange behaviour on 'read' from a pipe

2012-04-01 Thread Lluís Batlle i Rossell
On Sun, Apr 01, 2012 at 11:06:22AM -0400, Chet Ramey wrote: > On 4/1/12 5:53 AM, Andreas Schwab wrote: > > >> It looks like a simple race condition. I suspect that the scheduler > >> arranges things so that the child process ends up exiting between the > >> open and the read, but I don't have any

Re: Strange behaviour on 'read' from a pipe

2012-04-01 Thread Chet Ramey
On 4/1/12 5:53 AM, Andreas Schwab wrote: >> It looks like a simple race condition. I suspect that the scheduler >> arranges things so that the child process ends up exiting between the >> open and the read, but I don't have any real evidence to back it up. > > Note that the opening of the pipe a

Re: Strange behaviour on 'read' from a pipe

2012-04-01 Thread Lluís Batlle i Rossell
On Sun, Apr 01, 2012 at 11:53:12AM +0200, Andreas Schwab wrote: > Chet Ramey writes: > > > On 3/31/12 9:19 AM, Lluís Batlle i Rossell wrote: > >> Hello, > >> > >> I have this script, that I've found to never write "DONE" in my systems, > >> with > >> bash 4.0, 4.1, 4.2.. until 4.2-p20, my last

Re: Strange behaviour on 'read' from a pipe

2012-04-01 Thread Andreas Schwab
Chet Ramey writes: > On 3/31/12 9:19 AM, Lluís Batlle i Rossell wrote: >> Hello, >> >> I have this script, that I've found to never write "DONE" in my systems, with >> bash 4.0, 4.1, 4.2.. until 4.2-p20, my last test. >> >> However, in irc some people told me it prints DONE for them. If I run t

Re: Strange behaviour on 'read' from a pipe

2012-04-01 Thread Lluís Batlle i Rossell
On Sat, Mar 31, 2012 at 09:16:20PM -0400, Chet Ramey wrote: > On 3/31/12 9:19 AM, Lluís Batlle i Rossell wrote: > > Hello, > > > > I have this script, that I've found to never write "DONE" in my systems, > > with > > bash 4.0, 4.1, 4.2.. until 4.2-p20, my last test. > > > > However, in irc some

Re: Strange behaviour on 'read' from a pipe

2012-03-31 Thread Chet Ramey
On 3/31/12 9:19 AM, Lluís Batlle i Rossell wrote: > Hello, > > I have this script, that I've found to never write "DONE" in my systems, with > bash 4.0, 4.1, 4.2.. until 4.2-p20, my last test. > > However, in irc some people told me it prints DONE for them. If I run the > script with > bash unde

Strange behaviour on 'read' from a pipe

2012-03-31 Thread Lluís Batlle i Rossell
Hello, I have this script, that I've found to never write "DONE" in my systems, with bash 4.0, 4.1, 4.2.. until 4.2-p20, my last test. However, in irc some people told me it prints DONE for them. If I run the script with bash under 'strace -f', it also prints DONE. So there is some kind of race