From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id KOp8DDtqjWKyOwEAbAwnHQ (envelope-from ) for ; Wed, 25 May 2022 01:28:59 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id kDGRDDtqjWKWZgEA9RJhRA (envelope-from ) for ; Wed, 25 May 2022 01:28:59 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id F317C1BD4E for ; Wed, 25 May 2022 01:28:58 +0200 (CEST) Received: from localhost ([::1]:57720 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ntdxR-0004AP-U1 for larch@yhetil.org; Tue, 24 May 2022 19:28:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41830) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ntdx8-0004A9-Nf for guix-devel@gnu.org; Tue, 24 May 2022 19:28:38 -0400 Received: from mail-40138.protonmail.ch ([185.70.40.138]:47786) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ntdx6-0002wy-Ag for guix-devel@gnu.org; Tue, 24 May 2022 19:28:38 -0400 Date: Tue, 24 May 2022 23:28:21 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail3; t=1653434906; x=1653694106; bh=EE5Obq8AhgrF0hB2W2X6AWpo9ktFZDuNJXSfvMS2R34=; h=Date:To:From:Cc:Reply-To:Subject:Message-ID:In-Reply-To: References:Feedback-ID:From:To:Cc:Date:Subject:Reply-To: Feedback-ID:Message-ID; b=jj7kVxQAv0gMglfdM8uNPha3rbX0EueiYvl+LnUkU7Q9+AfGxFS0q/6+P6D46oRoB tknq07A3EzNH4+Dv0YOnGotqqBOwTlsxlnBgdIJZQrT10HDtCtQkzIq+Ia/ROoofPd NS4zpgd+5tlRYPNVzYcYR4xi0m3PyI/4/WdREwxqVVitJlv2Nct77rzbRVqrpvxmVv Y7ihF9T+UvmTxX0MoiXKHM0EyvQ1k54PzxOxGn+W81k6z9pMOunno2BtBUdFxnKeFj XhTKv9+qyBr9z1TuP9pojUhao64qWl3kwaCs5nMgi8bwP8ufV1A3FaFD/tDtLRTuN0 ph1wOXLQ2s0Gg== To: Foo Chuan Wei From: Kaelyn Cc: Ryan Prior , guix-devel@gnu.org Subject: Re: Why does sh in the build environment ignore SIGINT and SIGQUIT? Message-ID: <8VtLOGZUg8YVybisO_g5Gll8zfSAHQKdJzzFKKrQdD2gudfNCDomBW4mjRJtHy7dEDLgar7sEbmxJhDkzLPR9dklsFRnWzECRGdaL6wBgag=@protonmail.com> In-Reply-To: References: <3Lw7OBQIW1WT7otx0UqOHHSducDQfScyqO2KP81NCHVUAmmmsGm9-DaGqGH4FKuCRcBi8vpDTydYEDu2Qk7hBo45CDERStJdavZipGwvmwI=@protonmail.com> Feedback-ID: 34709329:user:proton MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=185.70.40.138; envelope-from=kaelyn.alexi@protonmail.com; helo=mail-40138.protonmail.ch X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: guix-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Kaelyn Errors-To: guix-devel-bounces+larch=yhetil.org@gnu.org Sender: "Guix-devel" X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1653434939; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=EE5Obq8AhgrF0hB2W2X6AWpo9ktFZDuNJXSfvMS2R34=; b=NvjJS1cZyCM5FLaQAv591ZXTEofB7OcXGSAkwilyORcTEIIVFzAQIrfoWaFsPQio99lRos tfIEe3fdhSoG9ZLaVVKTG5TKY006PxMcpd4Mruv8YQLbm9rixtjgNYuNjn+3OybYL8pR1u efARKPkpUCiPlVFITJmKWHyw4v18AXOHvNzWiCjCzz3bBHGoQuU+yD3kEkwdRCaDdGJ1oj fVfvEvqaFdrYsw5jMCLlWGBzjDovTRxE9HceSpESAjMosEEvmLO9MyrhuUq2DxxA/Zizo1 PgahBMKAAYncyNbxiw4EBWXkmcMZ1LuTyCCjhmYrR9Yfzbxq1do+8SqPxKZOIQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1653434939; a=rsa-sha256; cv=none; b=qyKR9QkgpjFBuU5V6oTs91l+Asf42Q/0/NhW0Y2Uy/8hg8K4wht3s8bv55GM3VvHPLEcl1 EZSMi8+QZLAlkz5oki0vS7JsQH9GwW/ugixdrbUIaJjSDYxC7Pgee1LWX4+5Urhyvnpf8Q aW9lr0qmcLrR2RYNuiKJZ3WPscrlde3GlUG+Q4hICDs6r9hdwRc+S+uNf9ZEa02N7ShX6v KNk4MNW7fOC3r8SFDAex1LqQHS90RQs7VrU/1mnwAE+f7nuZcaVUPO/tbe8u4Ordq+Gxsu gMki2uNse7keGs1P0/ZVF5cM4p6rBLu5pemCJf4xHBy2uqYm7MXxEPtjo+gC2g== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=protonmail.com header.s=protonmail3 header.b=jj7kVxQA; dmarc=pass (policy=quarantine) header.from=protonmail.com; spf=pass (aspmx1.migadu.com: domain of "guix-devel-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-devel-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -3.05 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=protonmail.com header.s=protonmail3 header.b=jj7kVxQA; dmarc=pass (policy=quarantine) header.from=protonmail.com; spf=pass (aspmx1.migadu.com: domain of "guix-devel-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-devel-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: F317C1BD4E X-Spam-Score: -3.05 X-Migadu-Scanner: scn0.migadu.com X-TUID: FXax/qMHthAJ Hi, ------- Original Message ------- On Monday, May 23rd, 2022 at 11:25 PM, Foo Chuan Wei wrote: > On 2022-05-23 03:14 +0000, Foo Chuan Wei wrote: > > > `(invoke "sh" "-c" "trap")` is merely a trivial example for > > demonstrating that the shell ignores SIGINT and SIGQUIT. This might be > > significant if the build step invokes the shell to do something more > > significant (e.g. to build something). > > > > Anyway, I found that this behavior is possibly related to one specified > > by POSIX [1]: > > > > > 2.11. Signals and Error Handling > > > > > > If job control is disabled (see the description of set -m) when the > > > shell executes an asynchronous list, the commands in the list shall > > > inherit from the shell a signal action of ignored (SIG_IGN) for the > > > SIGINT and SIGQUIT signals. > > > Maybe not. Guix's `invoke` procedure uses Guile's `system*` procedure, > which ignores SIGINT and SIGQUIT as can be seen in Guile's source code: > https://git.savannah.gnu.org/cgit/guile.git/tree/libguile/posix.c?h=3Dv3.= 0.8#n1524 > > > Do you have a solution to this problem? > > > Guile's `system` procedure does not have this problem (compare > `(system "bash -c trap")` with `(system* "bash" "-c" "trap")`). > One possible solution is to replace `invoke` with `system`: While `system` may not show the problem that `system*`, note that they aren= 't strictly interchangeable. To quote https://www.gnu.org/software/guile/ma= nual/html_node/Processes.html#index-system_002a: "system* is similar to system, but accepts only one string per-argument, an= d performs no shell interpretation. The command is executed using fork and = execlp. Accordingly this function may be safer than system in situations wh= ere shell interpretation is not required." Cheers, Kaelyn > > diff --git a/gnu/packages/sml.scm b/gnu/packages/sml.scm > index 04411c02c3..fafdba9a3f 100644 > --- a/gnu/packages/sml.scm > +++ b/gnu/packages/sml.scm > @@ -175,10 +175,14 @@ function interface, and a symbolic debugger.") > "sml.boot.amd64-unix/SMLNJ-BASIS/.cm/amd64-unix/basis-common.cm")) > > ;; Build. > - (invoke "./config/install.sh" "-default" > - (if (string=3D? "i686-linux" ,(%current-system)) > - "32" > - "64")) > + (let ((exit-code > + (system (string-append "./config/install.sh -default " > + (if (string=3D? "i686-linux" > + ,(%current-system)) > + "32" > + "64"))))) > + (unless (zero? exit-code) > + (error (format #f "Exit code: ~a" exit-code)))) > > ;; Undo the binary patch. > (for-each