From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Newsgroups: gmane.lisp.guile.bugs Subject: bug#46403: SIGINT ignored when using system* Date: Sun, 02 May 2021 01:19:10 +0200 Message-ID: <87wnsi59g1.fsf@gnu.org> References: <87zh0dqr9l.fsf@elephly.net> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="34739"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) Cc: 46403@debbugs.gnu.org To: Ricardo Wurmus Original-X-From: bug-guile-bounces+guile-bugs=m.gmane-mx.org@gnu.org Sun May 02 01:20:07 2021 Return-path: Envelope-to: guile-bugs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lcyu6-0008vX-C1 for guile-bugs@m.gmane-mx.org; Sun, 02 May 2021 01:20:06 +0200 Original-Received: from localhost ([::1]:51304 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lcyu5-0003Wb-EG for guile-bugs@m.gmane-mx.org; Sat, 01 May 2021 19:20:05 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:54486) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lcyu2-0003WM-3D for bug-guile@gnu.org; Sat, 01 May 2021 19:20:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:55647) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lcyu1-00089m-QT for bug-guile@gnu.org; Sat, 01 May 2021 19:20:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lcyu1-0006sV-ME for bug-guile@gnu.org; Sat, 01 May 2021 19:20:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: bug-guile@gnu.org Resent-Date: Sat, 01 May 2021 23:20:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 46403 X-GNU-PR-Package: guile Original-Received: via spool by 46403-submit@debbugs.gnu.org id=B46403.161991116026414 (code B ref 46403); Sat, 01 May 2021 23:20:01 +0000 Original-Received: (at 46403) by debbugs.gnu.org; 1 May 2021 23:19:20 +0000 Original-Received: from localhost ([127.0.0.1]:38958 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lcytM-0006ry-Am for submit@debbugs.gnu.org; Sat, 01 May 2021 19:19:20 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:46142) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lcytJ-0006rm-Tx for 46403@debbugs.gnu.org; Sat, 01 May 2021 19:19:18 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:50917) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lcytE-0007gn-JF; Sat, 01 May 2021 19:19:12 -0400 Original-Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=46110 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1lcytE-0007EY-71; Sat, 01 May 2021 19:19:12 -0400 In-Reply-To: <87zh0dqr9l.fsf@elephly.net> (Ricardo Wurmus's message of "Tue, 09 Feb 2021 14:56:06 +0100") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-guile@gnu.org List-Id: "Bug reports for GUILE, GNU's Ubiquitous Extension Language" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guile-bounces+guile-bugs=m.gmane-mx.org@gnu.org Original-Sender: "bug-guile" Xref: news.gmane.io gmane.lisp.guile.bugs:10026 Archived-At: Hi! Ricardo Wurmus skribis: > I execute commands in a loop and wish to be able to interrupt the loop > with SIGINT. Here=E2=80=99s the first attempt: > > guile -c \ > '(for-each (lambda (n) > (display n) > (system* "sleep" "3")) > (list 1 2 3 4))' > > At no point will this program be interrupted by SIGINT. Strace reveals > that SIGINT is in fact received and the sleep is interrupted, but the > wait is restarted immediately afterward. =E2=80=98system*=E2=80=99 explicitly ignores SIGINT: --8<---------------cut here---------------start------------->8--- /* Make sure the child can't kill us (as per normal system call). */ scm_dynwind_sigaction (SIGINT, scm_from_uintptr_t ((uintptr_t) SIG_IGN), SCM_UNDEFINED); --8<---------------cut here---------------end--------------->8--- Indeed, system(3) says: During execution of the command, SIGCHLD will be blocked, and SIGINT and SIGQUIT will be ignored, in the process that calls system(). (These signals will be handled according to their defaults inside the child process that executes command.) (I did some archaeology and found it has always been this way since Rob introduced =E2=80=98system*=E2=80=99 in 0db17ef9abd59da51ebc30d90fb2dc482b0= 2a4a1.) > Is this by design? I think so! Ludo=E2=80=99.