posix: Ensure the initial signal disposition for tst-spawn7
Checks
Context |
Check |
Description |
dj/TryBot-apply_patch |
success
|
Patch applied to master at the time it was sent
|
dj/TryBot-32bit |
success
|
Build for i686
|
Commit Message
To avoid possible failure if any parent set any initial signal
disposition as SIG_IGN.
Checked on x86_64-linux-gnu.
---
posix/tst-spawn7.c | 6 ++++++
1 file changed, 6 insertions(+)
Comments
* Adhemerval Zanella via Libc-alpha:
> To avoid possible failure if any parent set any initial signal
> disposition as SIG_IGN.
>
> Checked on x86_64-linux-gnu.
> ---
> posix/tst-spawn7.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/posix/tst-spawn7.c b/posix/tst-spawn7.c
> index fedb09fb94..fb06915cb7 100644
> --- a/posix/tst-spawn7.c
> +++ b/posix/tst-spawn7.c
> @@ -99,6 +99,12 @@ dummy_sa_handler (int signal)
> static void
> do_test_signals (void)
> {
> + /* Ensure the initial signal disposition, ignore EINVAL for internal
> + signal such as SIGCANCEL. */
> + for (int sig = 1; sig < _NSIG; ++sig)
> + sigaction (sig, &(struct sigaction) { .sa_handler = SIG_DFL,
> + .sa_flags = 0 }, NULL);
> +
> {
> /* Check if all signals handler are set to SIG_DFL on spawned process. */
> spawn_signal_test ("SIG_DFL", NULL);
Finally found out what's causing my failure: running the test suite with
“nohup”. Maybe you could mention this in the comment? Anyway, the
patch is fixing things.
I suspect H.J. is doing the same. 8-)
Tested-by: Florian Weimer <fweimer@redhat.com>
Reviewed-by: Florian Weimer <fweimer@redhat.com>
Thanks,
Florian
On 08/03/23 06:44, Florian Weimer wrote:
> * Adhemerval Zanella via Libc-alpha:
>
>> To avoid possible failure if any parent set any initial signal
>> disposition as SIG_IGN.
>>
>> Checked on x86_64-linux-gnu.
>> ---
>> posix/tst-spawn7.c | 6 ++++++
>> 1 file changed, 6 insertions(+)
>>
>> diff --git a/posix/tst-spawn7.c b/posix/tst-spawn7.c
>> index fedb09fb94..fb06915cb7 100644
>> --- a/posix/tst-spawn7.c
>> +++ b/posix/tst-spawn7.c
>> @@ -99,6 +99,12 @@ dummy_sa_handler (int signal)
>> static void
>> do_test_signals (void)
>> {
>> + /* Ensure the initial signal disposition, ignore EINVAL for internal
>> + signal such as SIGCANCEL. */
>> + for (int sig = 1; sig < _NSIG; ++sig)
>> + sigaction (sig, &(struct sigaction) { .sa_handler = SIG_DFL,
>> + .sa_flags = 0 }, NULL);
>> +
>> {
>> /* Check if all signals handler are set to SIG_DFL on spawned process. */
>> spawn_signal_test ("SIG_DFL", NULL);
>
> Finally found out what's causing my failure: running the test suite with
> “nohup”. Maybe you could mention this in the comment? Anyway, the
> patch is fixing things.
I will add the nohup note, thanks.
>
> I suspect H.J. is doing the same. 8-)
>
> Tested-by: Florian Weimer <fweimer@redhat.com>
> Reviewed-by: Florian Weimer <fweimer@redhat.com>
>
> Thanks,
> Florian
>
@@ -99,6 +99,12 @@ dummy_sa_handler (int signal)
static void
do_test_signals (void)
{
+ /* Ensure the initial signal disposition, ignore EINVAL for internal
+ signal such as SIGCANCEL. */
+ for (int sig = 1; sig < _NSIG; ++sig)
+ sigaction (sig, &(struct sigaction) { .sa_handler = SIG_DFL,
+ .sa_flags = 0 }, NULL);
+
{
/* Check if all signals handler are set to SIG_DFL on spawned process. */
spawn_signal_test ("SIG_DFL", NULL);