NetBSD-Bugs archive

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

Re: bin/47524: make(1) loops in Job_CatchOutput()



The following reply was made to PR bin/47524; it has been noted by GNATS.

From: David Laight <david%l8s.co.uk@localhost>
To: gnats-bugs%NetBSD.org@localhost
Cc: gnats-admin%netbsd.org@localhost, netbsd-bugs%netbsd.org@localhost
Subject: Re: bin/47524: make(1) loops in Job_CatchOutput()
Date: Sat, 2 Feb 2013 19:10:56 +0000

 On Sat, Feb 02, 2013 at 02:15:01PM +0000, Andreas Gustafsson wrote:
 > >Number:         47524
 > >Category:       bin
 > >Synopsis:       make(1) loops in Job_CatchOutput()
 ...
 > @@ -2046,7 +2050,8 @@
 >      if (nready < 0 || readyfd(&childExitJob)) {
 >      char token = 0;
 >      nready -= 1;
 > -    (void)read(childExitJob.inPipe, &token, 1);
 > +    while (read(childExitJob.inPipe, &token, 1) == -1 && errno == EAGAIN)
 > +            continue;
 >      if (token == DO_JOB_RESUME[0])
 >          /* Complete relay requested from our SIGCONT handler */
 >          JobRestartJobs();
 > 
 > I believe the "while" loop added by this change is where make is now
 > looping.
 
 I'd guess that fd in non-blocking so EAGAIN would just mean that the
 pipe is empty.
 The purpose of the read() is to empty the pipe, If it is already empty
 it won't matter.
 I think you'll find the sigchild handler writes into it, possibly
 with some check of nready (not looked) to wake things up.
 
 Most likely two children finishing at once only write 1 character,
 or some path comes in with nready < 0 ...
 
        David
 
 -- 
 David Laight: david%l8s.co.uk@localhost
 


Home | Main Index | Thread Index | Old Index