Subject: bug#8855: dbus error at startup

From: Eli Zaretskii <[email-masked]>
Date: Mon, 29 Oct 2012 19:06:56 +0200

> From: Chong Yidong <[email-masked]>
> Cc: Eli Zaretskii <[email-masked]>,  [email-masked]
> Date: Mon, 29 Oct 2012 17:24:28 +0800
> 
> Paul Eggert <[email-masked]> writes:
> 
> > Attached is a slightly less-intrusive version of the patch.
> > It omits the removal of "#ifdef SIGCHLD", which isn't
> > strictly needed to fix the bug.  I don't see any further
> > simplifications, unfortunately.  The patch fixes a bug that's
> > been reported multiple times so I'm thinking it may be
> > worthwhile to install now, even though there's a feature
> > freeze.
> 
> I think the patch is OK to commit.

I agree.

I also think that after the feature freeze is lifted, it would be good
to refactor the related code so that, e.g., the loop in
process_status_retrieved is joined with the loop(s) in
record_child_status_change.  Since we are now asking about a single
process at a time, I don't see why we need a loop inside a loop.
Previous code didn't have this nested-loop structure, AFAICS.

Btw, what about Posix platforms that don't have WNOHANG defined, and
therefore have 'waitpid' redirected to 'wait' -- are they the same
ones which have CAN_HANDLE_MULTIPLE_CHILDREN set to zero?  (The cpp
directives don't match.)  If some of them don't, then will this new
code work for them with 'wait'?

P.S.  Incidentally, the MS-Windows build always had a 'waitpid'-like
implementation of its 'wait' emulation, it just pretended to be
checking all of its child processes, because that's what the mainline
code wanted, but actually always knew which process it should check
for.  I guess time is ripe for refactoring that code into an emulation
of 'waitpid'.

P.P.S.  We use record_child_status_change in another place as well: in
sysdep.c:wait_for_termination_1.  Will the change in the former still
work correctly in the latter (and its callers)?