unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
From: "Ludovic Courtès" <ludo@gnu.org>
To: Olivier Dion <olivier.dion@polymtl.ca>
Cc: 73589-done@debbugs.gnu.org
Subject: bug#73589: system* does not honor SIGINT restoration in child
Date: Sun, 20 Oct 2024 20:58:14 +0200	[thread overview]
Message-ID: <875xpmmwjd.fsf@gnu.org> (raw)
In-Reply-To: <87jzer7djc.fsf@laura> (Olivier Dion's message of "Tue, 01 Oct 2024 16:51:03 -0400")

Hi,

Olivier Dion <olivier.dion@polymtl.ca> skribis:

> and its ouput from various executions:
>
>   1) $ ./a.out => (nil) 0x1 (nil)
>   2) $ guile -c '(system "./a.out")' => (nil) 0x1 (nil)
>   3) $ guile -c '(system* "./a.out")' => 0x1 0x1 (nil)
>
> We can see that 3) does not honor restoration of `SIGINT' to `SIG_DFL'
> like `system(3)' does.  This seems to be because of the following
> sigaction before the creation of the process:
>
> 1697  scm_dynwind_sigaction (SIGINT,
> 1698                         scm_from_uintptr_t ((uintptr_t) SIG_IGN),
> 1699                         SCM_UNDEFINED);
> 1700 #ifdef SIGQUIT
> 1701  scm_dynwind_sigaction (SIGQUIT,
> 1702                         scm_from_uintptr_t ((uintptr_t) SIG_IGN),
> 1703                         SCM_UNDEFINED);
> 1704 #endif
> 1705
> 1706  err = piped_process (&pid, prog, args,
> 1707                       SCM_UNDEFINED, SCM_UNDEFINED);

This was fixed in commit 4ae33f76d6b33ea0bedfa36050d44c88d08c2823, which
is included in 3.0.10:

--8<---------------cut here---------------start------------->8---
$ cat t.c
#include <stdio.h>
#include <signal.h>

int main(void)
{
	struct sigaction act;

	sigaction(SIGINT, NULL, &act);

	printf("%p %p %p\n", act.sa_handler, SIG_IGN, SIG_DFL);
}
$ gcc -Wall t.c
$ ./a.out 
(nil) 0x1 (nil)
$ ./meta/guile -c '(system "./a.out")'
(nil) 0x1 (nil)
$ ./meta/guile -c '(system* "./a.out")'
(nil) 0x1 (nil)
--8<---------------cut here---------------end--------------->8---

Ludo’.





      reply	other threads:[~2024-10-20 18:58 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-01 20:51 bug#73589: system* does not honor SIGINT restoration in child Olivier Dion
2024-10-20 18:58 ` Ludovic Courtès [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=875xpmmwjd.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=73589-done@debbugs.gnu.org \
    --cc=olivier.dion@polymtl.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).