bug-gawk
[Top][All Lists]
Advanced

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

Re: fflush & close behavior not well-defined


From: Chet Ramey
Subject: Re: fflush & close behavior not well-defined
Date: Thu, 1 Oct 2020 10:10:42 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:68.0) Gecko/20100101 Thunderbird/68.12.0

On 10/1/20 8:43 AM, Andrew J. Schorr wrote:

> 
> But I still don't understand the inconsistency in strace output. In my
> test, I saw this:
> 
> --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_KILLED, si_pid=3899, si_uid=300, 
> si_status=SIGPIPE, si_utime=0, si_stime=0} ---
> 
> And when you ran strace, you got this:
> 
> --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=29075, si_uid=1000, 
> si_status=141, si_utime=0, si_stime=0} ---
> 
> Notice that my child process exited due to the signal with CLD_KILLED, whereas
> yours exited with CLD_EXITED. One child bash shell exited due to SIGPIPE,
> whereas the other seems to have trapped it and then exited in a more orderly
> fashion, I guess.  I don't know whether this is a race condition or some other
> subtle issue relating to which child process received the SIGPIPE (bash vs 
> cat).

It looks like a race condition that's dependent on whether the writer
process gets killed by the the SIGPIPE before the cat exits and the shell
reaps it normally.


-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet@case.edu    http://tiswww.cwru.edu/~chet/



reply via email to

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