From patchwork Sat May 3 14:38:28 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hilton Chain X-Patchwork-Id: 42272 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 16F0327BC4A; Sat, 3 May 2025 15:40:24 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,FROM_SUSPICIOUS_NTLD,MAILING_LIST_MULTI,PDS_OTHER_BAD_TLD, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_VALIDITY_CERTIFIED,RCVD_IN_VALIDITY_RPBL, RCVD_IN_VALIDITY_SAFE,SPF_HELO_PASS,URIBL_BLOCKED autolearn=unavailable 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 6671127BC49 for ; Sat, 3 May 2025 15:40:22 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uBE2C-0002jP-LK; Sat, 03 May 2025 10:40:08 -0400 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 1uBE2A-0002hH-IX for guix-patches@gnu.org; Sat, 03 May 2025 10:40:06 -0400 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 1uBE29-00069g-IC; Sat, 03 May 2025 10:40:05 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:From:To:In-Reply-To:References:Subject; bh=A35hReIphueLp4780qm3YeTXhvPe//rP+T3l7O8fBvw=; b=Yq8pYMWyjglkqRshW00qRjoxrng6vvu9tRqSZhieQymXoqkpb37QFQIP1LvgwkMnoHQfmzv/u8fOD7Qnw/BKaPl8ZNVfiWuwkhVm2uvLunYM1mUKnZFVrvrBZWsFlZEj0BAT0PHbQMMsz0HTZJqWZKd0O4E2BVzp2mUED70SJGR+dnZ00buvtqb18hC3XEnFZ2G4waWRAgjAvVzxMqpaPYYCLKgD2yleKqY1k5vg+HbBa+0b4NH2Ims5QBezg1JO+lL8rpfKEWAUmc7uVl88c6U/tmcru9mzkREvDAqNAJi90lrgBt7OjcLMYep4zicU023xHS0UROxInbC1OCVl8A==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1uBE25-0002oh-KQ; Sat, 03 May 2025 10:40:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#73494] [PATCH v6 1/3] services: activation: Continue on exceptions. References: In-Reply-To: Resent-From: Hilton Chain Original-Sender: "Debbugs-submit" Resent-CC: hako@ultrarare.space, maxim.cournoyer@gmail.com, ludo@gnu.org, vagrant@debian.org, zhengjunjie@iscas.ac.cn, guix-patches@gnu.org Resent-Date: Sat, 03 May 2025 14:40:01 +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 , Z572 X-Debbugs-Original-Xcc: Hilton Chain , Maxim Cournoyer , Ludovic =?utf-8?q?Court=C3=A8s?= , Vagrant Cascadian , Z572 Received: via spool by 73494-submit@debbugs.gnu.org id=B73494.174628316210683 (code B ref 73494); Sat, 03 May 2025 14:40:01 +0000 Received: (at 73494) by debbugs.gnu.org; 3 May 2025 14:39:22 +0000 Received: from localhost ([127.0.0.1]:42118 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uBE1R-0002mE-It for submit@debbugs.gnu.org; Sat, 03 May 2025 10:39:22 -0400 Received: from mail.boiledscript.com ([49.12.134.184]:50612) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uBE1O-0002lr-8Y for 73494@debbugs.gnu.org; Sat, 03 May 2025 10:39:19 -0400 From: Hilton Chain DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ultrarare.space; s=mail; t=1746283156; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=A35hReIphueLp4780qm3YeTXhvPe//rP+T3l7O8fBvw=; b=C72TGmQJwnUVmCMYicAOJiNnhdRFSSI3BuUllrsjvGzomIx5v6Qp+A+LoteSsyT/fS96DU YZnqqMLO1EV/m2D/yaanL5fNtsjwrj0PhETsWxUD3nblCDVBQZkuOFdjVh4guSg3O+r5Qn 9tgc6miJQnG2mHx+nffZEhFlgX2HSb2r0mEcn3LWRQgg5uwBMe9knNEKUT5x1XMcWLjDdl hNy8tqBa8Henfw71Y8eaNrYxvGfqjt8gn3yW5AExnwKxKYGqVBygpFnzX/i1GBYGDhtKWK 25GSKmsvfktLA0pG46oedhp3IcnywLqwkAzu6YSPmzj6L+MllKNsHl4OQ9rNzQ== Date: Sat, 3 May 2025 22:38:28 +0800 Message-ID: MIME-Version: 1.0 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 * gnu/services.scm (activation-script): Reset environment before loading activation script. Catch exception and print the error. Warn about failed activation script. Change-Id: I89be31433fbb46d0c4a9dc6115ab167910840b6f --- gnu/services.scm | 39 +++++++++++++++++++++++++++++++++++---- 1 file changed, 35 insertions(+), 4 deletions(-) base-commit: 415e3d98d6faf5fd3d1b7b3daa2f20636e4ff822 prerequisite-patch-id: cb3ac50fb870cf197a4e3ed2ccfb45a6a28400f1 prerequisite-patch-id: 2579801cc89f3e3e022074a0425fba3d38bbe1de prerequisite-patch-id: 7174912f7b05011468bc47b2ba8167b0e617a70b prerequisite-patch-id: 08fa38ca1e61c773052671339b78799f19fb7f60 prerequisite-patch-id: b68df6ad7528101d3fbb1fd44f94472a9c8f4f0a prerequisite-patch-id: 58297e005e4ad0988bd5dc73cd0149637d5c7032 prerequisite-patch-id: 2c09773480fbfd323433986ec528fcb8019273f9 prerequisite-patch-id: e2846320c8b391ff3fec09e51c31578ee6057268 prerequisite-patch-id: 538047ea2f029dd135319c02ba569c4aab9af38d prerequisite-patch-id: 4fb73799b5ea902d69ecf15b72e1fecc9903d0bc prerequisite-patch-id: a3a0146e6686bf6f7804192e1a383239c118717b prerequisite-patch-id: 8de6616d86785be0088bc210202d375b6d0cf5eb prerequisite-patch-id: 2f32dcab8b97a4fd210ab5b29b6ebf327861be36 prerequisite-patch-id: 081be41a50854a1397ad6574d995ba444b927a7f prerequisite-patch-id: 2a631555713d3b74f953673f94877e579045f99c prerequisite-patch-id: b3d778b43f667e73692e1bd8b8945eaf69540fda diff --git a/gnu/services.scm b/gnu/services.scm index 8a4002e072..af054339fd 100644 --- a/gnu/services.scm +++ b/gnu/services.scm @@ -692,15 +692,31 @@ (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)) + ;; TODO: Instead of importing modules here, let users of activation service + ;; add them explicitly. See . + (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) + (srfi srfi-34)) (mkdir-p "/var/run") ;; Make sure the user accounting database exists. If it @@ -720,7 +736,22 @@ (define (activation-script gexps) ;; 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. + (guard (condition + (else + (format (current-error-port) "~a~%" + condition) + (warning + (G_ "failed to activate '~a'~%") + action))) + (save-module-excursion + (lambda () + (set-current-module + (make-fresh-user-module)) + (primitive-load action))))) + '#$actions))))) (define (gexps->activation-gexp gexps) "Return a gexp that runs the activation script containing GEXPS."