From patchwork Thu Mar 6 02:38:41 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Hilton Chain X-Patchwork-Id: 39715 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id DAB9527BBEA; Thu, 6 Mar 2025 02:40:19 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-6.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,FROM_SUSPICIOUS_NTLD,MAILING_LIST_MULTI, PDS_OTHER_BAD_TLD,RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H2, RCVD_IN_VALIDITY_CERTIFIED,RCVD_IN_VALIDITY_RPBL,RCVD_IN_VALIDITY_SAFE, SPF_HELO_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 7104E27BBE2 for ; Thu, 6 Mar 2025 02:40:17 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tq19Z-0005H1-LZ; Wed, 05 Mar 2025 21:40:05 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tq19Y-0005Ge-5P for guix-patches@gnu.org; Wed, 05 Mar 2025 21:40:04 -0500 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tq19X-0005Ts-RQ; Wed, 05 Mar 2025 21:40:03 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:References:In-Reply-To:Date:From:To:Subject; bh=P3mvAwJunBrnjKMclNXpGdabxdtITDWXuNcI0K+g+OU=; b=GTz6HzQrAnNLGZqSf89NRO5mtUluc2plSydbyBK+/ur3chou+dT9w5IRqtE2rT0Op93QOJnUMVQ97kJjCr+5hI83DFGKuxUX90kiKm/7Ujaw6s6SSLPk39EmD+P16DwbYg3uVpioruJVMM81Jb37U2RY1ytey+N+0CGQz/JRQVj2FtZxZ1lpYts8d2dSKGnY+C41/8++G3+Vy6gLtTZc5OVbEGYAR6f1exKgZyDWhWy7iYVjF0V3OiM2LwadEcP2pd95OU1PnudFOz8/Ckl+YGgmjCLblBEWxv4X0KOxfcOugr1/+1+cbnijuARb48vaDLNrd5ynfQeRw0ULDAZHgQ==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tq19X-000258-7q; Wed, 05 Mar 2025 21:40:03 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#73494] [PATCH v2 3/3] services: activation: Continue on exceptions. Resent-From: Hilton Chain Original-Sender: "Debbugs-submit" Resent-CC: hako@ultrarare.space, maxim.cournoyer@gmail.com, ludo@gnu.org, vagrant@debian.org, guix-patches@gnu.org Resent-Date: Thu, 06 Mar 2025 02:40:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 73494 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 73494@debbugs.gnu.org Cc: Hilton Chain , Hilton Chain , Maxim Cournoyer , Ludovic =?utf-8?q?Court=C3=A8s?= , Vagrant Cascadian X-Debbugs-Original-Xcc: Hilton Chain , Maxim Cournoyer , Ludovic =?utf-8?q?Court=C3=A8s?= , Vagrant Cascadian Received: via spool by 73494-submit@debbugs.gnu.org id=B73494.17412287667915 (code B ref 73494); Thu, 06 Mar 2025 02:40:03 +0000 Received: (at 73494) by debbugs.gnu.org; 6 Mar 2025 02:39:26 +0000 Received: from localhost ([127.0.0.1]:40591 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tq18w-00023b-D5 for submit@debbugs.gnu.org; Wed, 05 Mar 2025 21:39:26 -0500 Received: from mx.boiledscript.com ([88.99.243.112]:39496) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tq18u-00023K-EH for 73494@debbugs.gnu.org; Wed, 05 Mar 2025 21:39:24 -0500 From: Hilton Chain DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ultrarare.space; s=mail; t=1741228763; h=from:from: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; bh=P3mvAwJunBrnjKMclNXpGdabxdtITDWXuNcI0K+g+OU=; b=WH+5rXXknsSPkeuJQNmIgiDXVnTCzZgZAEItkXkvueCHllAKhK0IgaYOy1Aa2pfwCrG016 FE2sxAuwsNzm+kCJmXQbcymHcK6vmEWERcn/JVQ5SJZegGdKhwma90amnJLUIi2KFMYdYs PMsC1wLg/v/IAfY3prHgxY6RSNaptgrZkFLXlpTPvUxIClt9JBg+KBlub9z5ohjKIFr1Kb 4uIg7m77p8dk3a1aDOZZ6azvV1DUkWbZpygWUJ9AmBg7Fx9xiFTE3aFUDvmq4Hjd4hgUSi mpdgOm2v825IW4KCLRwY5ALlP6msjXkjFFOcm/9pDWKMIRgtWfpb62lG4q/74g== Date: Thu, 6 Mar 2025 10:38:41 +0800 Message-ID: <317ca0d525d3f2c668a9ec2c5357b3ca924ee1a7.1741228110.git.hako@ultrarare.space> In-Reply-To: References: MIME-Version: 1.0 X-MS-Reactions: disallow X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches Use ‘invoke’ for backtraces and avoid changing environment. * gnu/services.scm (activation-script): Execute activation scripts in ‘invoke’. Warn about failed activation scripts. Change-Id: I89be31433fbb46d0c4a9dc6115ab167910840b6f --- gnu/services.scm | 32 +++++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/gnu/services.scm b/gnu/services.scm index 7805cae971..3a511a42e5 100644 --- a/gnu/services.scm +++ b/gnu/services.scm @@ -690,15 +690,28 @@ (define* (activation-service->script service) (define (activation-script gexps) "Return the system's activation script, which evaluates GEXPS." (define actions - (map (cut program-file "activate-service.scm" <>) gexps)) + (map (lambda (action) + (program-file "activate-service.scm" + (with-imported-modules (source-module-closure + '((gnu build activation) + (guix build utils))) + #~(begin + (use-modules (gnu build activation) + (guix build utils)) + #$action)))) + gexps)) (program-file "activate.scm" (with-imported-modules (source-module-closure '((gnu build activation) - (guix build utils))) + (guix build utils) + (guix diagnostics) + (guix i18n))) #~(begin (use-modules (gnu build activation) - (guix build utils)) + (guix build utils) + (guix diagnostics) + (guix i18n)) (mkdir-p "/var/run") ;; Make sure the user accounting database exists. If it @@ -717,8 +730,17 @@ (define (activation-script gexps) (activate-current-system) ;; Run the services' activation snippets. - ;; TODO: Use 'load-compiled'. - (for-each primitive-load '#$actions))))) + (for-each (lambda (action) + ;; Don't block activation process when one + ;; action fails. + (catch #t + (lambda () + (invoke action)) + (lambda _ + (warning + (G_ "failed to activate '~a'.~%") + action)))) + '#$actions))))) (define (gexps->activation-gexp gexps) "Return a gexp that runs the activation script containing GEXPS."