bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Strange behaviour on 'read' from a pipe


From: Chet Ramey
Subject: Re: Strange behaviour on 'read' from a pipe
Date: Sun, 01 Apr 2012 18:27:46 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:10.0.2) Gecko/20120216 Thunderbird/10.0.2

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 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 as part of the redirection in the
>>> parent blocks until there is a writer, ie. until the child opens the
>>> pipe.  Can this open call return EINTR?
>>
>> open() is supposed to return EINTR only if interrupted by a signal.  The
>> only signal I can see occurring is SIGCHLD, and bash installs the SIGCHLD
>> handler with SA_RESTART.
> 
> Then, any idea of what can be happening?

It looks like a race condition, like I said.  I can't reproduce it on my
system, so I don't have anything to troubleshoot.


Chet
-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU    address@hidden    http://cnswww.cns.cwru.edu/~chet/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]