This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] manual: don't ignore SIGCHLD when calling waitpid
- From: Adhemerval Zanella <adhemerval dot zanella at linaro dot org>
- To: Paul Eggert <eggert at cs dot ucla dot edu>
- Cc: libc-alpha at sourceware dot org
- Date: Wed, 17 Apr 2019 17:07:47 -0300
- Subject: Re: [PATCH] manual: don't ignore SIGCHLD when calling waitpid
- References: <UeWQ4A1a4GgI6uaX0Mud4BwN2NlaSaJU3UHzLm5wxpZTbkxvq5HMLy_lxja53gYGMmaJ0uRH7hJv94BX8hxnAyVDsIhRFxMNJwVf33oCLS4=@emersion.fr> <mrSMqWcdkD4oDu3VVfhHxrlKvush4ZHdIIsixwqu4XIPxZuzuGB_19gVPSUesb9OXB9uqmZrJqmYbAwVNpVMjNvkHN08BmP1FT6M5KPWKjY=@emersion.fr> <4498cfca-28d0-f868-b46c-562050447bf5@linaro.org> <d15fee79-0aad-bcf0-6ff8-aa34f92f69a1@cs.ucla.edu>
On 17/04/2019 16:44, Paul Eggert wrote:
> On 4/17/19 12:05 PM, Adhemerval Zanella wrote:
>> My understanding of the example is for interactive shells (shell_is_interactive),
>> the idea is only to get child information to the explicit launched processes done
>> by launch_process, so ignoring and reseting SIGCHLD seems ok.
>
> Sure, but the problem is that launch_process is used only in the child,
> which means the parent shell always ignores SIGCHLD, so if the parent
> calls do_job_notification it won't get any info about children. Perhaps
> this could be fixed by documenting do_job_notification as requiring that
> SIGCHLD be reenabled before calling it, but that's pretty confusing.
Right, I missed this part indeed.
>
> Also the proposed change to the manual is not enough, as there's other
> text saying that the sample shell program ignores SIGCHLD. Presumably
> this is to avoid races in the parent shell. But if SIGCHLD causes races
> in the parent, then the parent typically should block SIGCHLD instead of
> ignoring it and similarly for the other signals - otherwise the fact
> that the signals arrived will be lost. So the whole example needs to be
> rethought.
>
Agreed.