From unknown Sun Jun 22 00:54:17 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#71928] [PATCH] gnu: Throw error when extending services that do not use extensions. Resent-From: Richard Sent Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 03 Jul 2024 22:14:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 71928 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 71928@debbugs.gnu.org Cc: Richard Sent X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.172004482927870 (code B ref -1); Wed, 03 Jul 2024 22:14:02 +0000 Received: (at submit) by debbugs.gnu.org; 3 Jul 2024 22:13:49 +0000 Received: from localhost ([127.0.0.1]:40933 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sP8EW-0007FS-LE for submit@debbugs.gnu.org; Wed, 03 Jul 2024 18:13:49 -0400 Received: from lists.gnu.org ([209.51.188.17]:47650) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sP8EV-0007FK-4T for submit@debbugs.gnu.org; Wed, 03 Jul 2024 18:13:47 -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 1sP8ES-0007kd-SG for guix-patches@gnu.org; Wed, 03 Jul 2024 18:13:44 -0400 Received: from mail-108-mta139.mxroute.com ([136.175.108.139]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sP8ER-0001S1-5P for guix-patches@gnu.org; Wed, 03 Jul 2024 18:13:44 -0400 Received: from filter006.mxroute.com ([136.175.111.3] filter006.mxroute.com) (Authenticated sender: mN4UYu2MZsgR) by mail-108-mta139.mxroute.com (ZoneMTA) with ESMTPSA id 1907aa90b5d00017a3.001 for (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384); Wed, 03 Jul 2024 22:13:37 +0000 X-Zone-Loop: 557bade68aaa11c4221e3a536d21c674027bc9e8c38a X-Originating-IP: [136.175.111.3] DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=freakingpenguin.com; s=x; h=Content-Transfer-Encoding:MIME-Version: Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=rNBm5jTy66oDdv/NCuz1/DMBQPaQo0xwiy9uyeOQ1aM=; b=GrK2qG8/xu0D2SYVfwF3ihvPbz O6vZKWu038BcB+oODrrDSSkyviYTOxDcP11PjkDpbtBIZRckXrUnxwAyW2XM9tXiMZAhsqLbrpEDh LYInQeq8qzr3VK9Ej/k35VE1D6Lg1FqKHk200JRYoWbl3c+4wS0FSXIGqQ7CQ7PG7v4Asn1PaVSPA QfqGfgljWGpOl5Ru8FxX3QWW4D8C+wF1TiqIGxRg123pVJH7IZYDGk4AkhVs6NGs08IOsJ8HyYB9C a7Lm9T4y6aQpaG7nfw66ZLceXuP2cYFcUtW3+jL8OOink9SYwMo61NoJ/FmghDOksuANyHOh9X2Zi 4WYSyZvg==; From: Richard Sent Date: Wed, 3 Jul 2024 18:12:48 -0400 Message-ID: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Authenticated-Id: richard@freakingpenguin.com Received-SPF: pass client-ip=136.175.108.139; envelope-from=richard@freakingpenguin.com; helo=mail-108-mta139.mxroute.com X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, DKIM_INVALID=0.1, DKIM_SIGNED=0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.4 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.4 (--) * gnu/services.scm (fold-services): Add error handling when using service extensions. Fixes: https://issues.guix.gnu.org/71887 Change-Id: Ic8d631674bfddde495c93952d9e6cd5649bb287d --- gnu/services.scm | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/gnu/services.scm b/gnu/services.scm index 88593e8091..a7a9e00478 100644 --- a/gnu/services.scm +++ b/gnu/services.scm @@ -1223,12 +1223,22 @@ (define* (fold-services services (params -> (service-value sink)) (service -> - ;; Distinguish COMPOSE and EXTEND because PARAMS typically - ;; has a different type than the elements of EXTENSIONS. - (if extend - (service (service-kind sink) - (extend params (compose extensions))) - sink))) + (begin + (unless (or (null? extensions) + ;; A value of #t is a convention for "make + ;; sure the service is present." + (every (cut eq? #t <>) extensions) + (and extend compose)) + (error (format #f "Extensions are not supported in \ +~a yet the following service types extend it:~{~% ~a~}" + (service-kind sink) + (map service-kind dependents)))) + ;; Distinguish COMPOSE and EXTEND because PARAMS typically + ;; has a different type than the elements of EXTENSIONS. + (if extend + (service (service-kind sink) + (extend params (compose extensions))) + sink)))) (mbegin %state-monad (set-current-state (vhash-consq sink service visited)) (return service)))) base-commit: 85012e64819b39fd6112038134548b415fd5daff -- 2.45.2 From unknown Sun Jun 22 00:54:17 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#71928] [PATCH v2] gnu: Throw error when extending services that do not use extensions. References: In-Reply-To: Resent-From: Richard Sent Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 03 Jul 2024 22:22:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 71928 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 71928@debbugs.gnu.org Cc: Richard Sent Received: via spool by 71928-submit@debbugs.gnu.org id=B71928.172004530928707 (code B ref 71928); Wed, 03 Jul 2024 22:22:02 +0000 Received: (at 71928) by debbugs.gnu.org; 3 Jul 2024 22:21:49 +0000 Received: from localhost ([127.0.0.1]:40945 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sP8MG-0007Sx-Od for submit@debbugs.gnu.org; Wed, 03 Jul 2024 18:21:49 -0400 Received: from mail-108-mta152.mxroute.com ([136.175.108.152]:42657) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sP8ME-0007Sn-2k for 71928@debbugs.gnu.org; Wed, 03 Jul 2024 18:21:47 -0400 Received: from filter006.mxroute.com ([136.175.111.3] filter006.mxroute.com) (Authenticated sender: mN4UYu2MZsgR) by mail-108-mta152.mxroute.com (ZoneMTA) with ESMTPSA id 1907ab05f2b00017a3.001 for <71928@debbugs.gnu.org> (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384); Wed, 03 Jul 2024 22:21:37 +0000 X-Zone-Loop: 8ed322636e3f31ca1675d7add40073809ec2609cf187 X-Originating-IP: [136.175.111.3] DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=freakingpenguin.com; s=x; h=Content-Transfer-Encoding:MIME-Version: Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=IycA4m6sJDJ7HMmKKGo9VPzfREj0CtantMOBzTnPAVo=; b=V0CCjjFhS3sySK98LmudQur583 zfQs75vCTzFSRsTW1Tnp3oDbmPX+/cmlYFCp84GUcyaF4j2ukCR2RC+JHZUdYT4hOWnyiyiq4oW4x YlSYFnsnNOmU2RDg6cdjNhaQt39oNM/0mb+mZDOTTSj9604y21ieS6XeVbZsC/13kWWuStoaYrWje ovDdrajQiq0xAcgijB3yCJa5sPPhzLDM9r0F3GteeXtXfsppBpLNyC3n5GuoAEkW2cpLu9Bexdf+9 JF4qYT8nxbWcBFoCJ/TJMTgsXenchCCuomytcd0Jk/Vx/hqgWjdGCkLbBwgtr86cRlsqMx2e2Cpk9 pXYgTGrA==; From: Richard Sent Date: Wed, 3 Jul 2024 18:21:01 -0400 Message-ID: <6afb44e7f09f2d8fdbbe4cd0bad92ca170aef1b0.1720045261.git.richard@freakingpenguin.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Authenticated-Id: richard@freakingpenguin.com X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) * gnu/services.scm (fold-services): Add error handling when using service extensions. Fixes: https://issues.guix.gnu.org/71887 Change-Id: Ic8d631674bfddde495c93952d9e6cd5649bb287d --- gnu/services.scm | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/gnu/services.scm b/gnu/services.scm index 88593e8091..f3a1041f14 100644 --- a/gnu/services.scm +++ b/gnu/services.scm @@ -53,6 +53,7 @@ (define-module (gnu services) #:use-module (srfi srfi-34) #:use-module (srfi srfi-35) #:use-module (srfi srfi-71) + #:use-module (ice-9 format) #:use-module (ice-9 vlist) #:use-module (ice-9 match) #:autoload (ice-9 pretty-print) (pretty-print) @@ -1223,12 +1224,22 @@ (define* (fold-services services (params -> (service-value sink)) (service -> - ;; Distinguish COMPOSE and EXTEND because PARAMS typically - ;; has a different type than the elements of EXTENSIONS. - (if extend - (service (service-kind sink) - (extend params (compose extensions))) - sink))) + (begin + (unless (or (null? extensions) + ;; A value of #t is a convention for "make + ;; sure the service is present." + (every (cut eq? #t <>) extensions) + (and extend compose)) + (error (format #f "Extensions are not supported in \ +~a yet the following service types extend it:~{~% ~a~}" + (service-kind sink) + (map service-kind dependents)))) + ;; Distinguish COMPOSE and EXTEND because PARAMS typically + ;; has a different type than the elements of EXTENSIONS. + (if extend + (service (service-kind sink) + (extend params (compose extensions))) + sink)))) (mbegin %state-monad (set-current-state (vhash-consq sink service visited)) (return service)))) base-commit: 85012e64819b39fd6112038134548b415fd5daff -- 2.45.2 From unknown Sun Jun 22 00:54:17 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#71928] [PATCH v2] gnu: Throw error when extending services that do not use extensions. Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 30 Sep 2024 21:11:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 71928 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Richard Sent Cc: 71928@debbugs.gnu.org Received: via spool by 71928-submit@debbugs.gnu.org id=B71928.172773061826726 (code B ref 71928); Mon, 30 Sep 2024 21:11:02 +0000 Received: (at 71928) by debbugs.gnu.org; 30 Sep 2024 21:10:18 +0000 Received: from localhost ([127.0.0.1]:47169 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1svNer-0006wu-70 for submit@debbugs.gnu.org; Mon, 30 Sep 2024 17:10:17 -0400 Received: from eggs.gnu.org ([209.51.188.92]:46366) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1svNFj-0002FQ-DW for 71928@debbugs.gnu.org; Mon, 30 Sep 2024 16:44:58 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1svNF5-0001Lw-To; Mon, 30 Sep 2024 16:43:40 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To: From; bh=zj179eTg/79GuZb3zw4jfSMRZPFz0BWcmXYTUVKV5QQ=; b=m/QSOzeBJbiBjIMst4+f XSix5LviubWFOa9r9xcuIUmQdUXhlgIg2grAVf2NjVxnAzp3mn2P2r3so+x+SJHXvWWgd2CPh2l+R 7zW9ZcOzGwDbL+UkpcyUE+JwtC1ox0LfYZeUudbg5q06BTgwlvXX4jajwgmwocyvUJNIBRZgsvICC wSD0WViuHQE/2ob9kAur8vcqocbxvnny2mJCbGb62dBaPyYvfVNZIGHdtVPnMciLTxIRZd6QFiCtt njRYcmul9LC8s9pplx/lqfrPn2O3IGBwEoSQZcIrpYYx3IRaQc/pOcoLCCOnF2PiYlIt/GLCQ1dP9 wez5Xu/vXYI0fw==; From: Ludovic =?UTF-8?Q?Court=C3=A8s?= In-Reply-To: <6afb44e7f09f2d8fdbbe4cd0bad92ca170aef1b0.1720045261.git.richard@freakingpenguin.com> (Richard Sent's message of "Wed, 3 Jul 2024 18:21:01 -0400") References: <6afb44e7f09f2d8fdbbe4cd0bad92ca170aef1b0.1720045261.git.richard@freakingpenguin.com> Date: Mon, 30 Sep 2024 22:43:36 +0200 Message-ID: <87h69w50uf.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Hello, Richard Sent skribis: > * gnu/services.scm (fold-services): Add error handling when using service > extensions. > > Fixes: https://issues.guix.gnu.org/71887 > Change-Id: Ic8d631674bfddde495c93952d9e6cd5649bb287d [...] > @@ -1223,12 +1224,22 @@ (define* (fold-services services > (params -> (service-value sink)) > (service > -> > - ;; Distinguish COMPOSE and EXTEND because PARAMS t= ypically > - ;; has a different type than the elements of EXTEN= SIONS. > - (if extend > - (service (service-kind sink) > - (extend params (compose extensions))) > - sink))) > + (begin > + (unless (or (null? extensions) > + ;; A value of #t is a convention for= "make > + ;; sure the service is present." > + (every (cut eq? #t <>) extensions) > + (and extend compose)) > + (error (format #f "Extensions are not supporte= d in \ > +~a yet the following service types extend it:~{~% ~a~}" > + (service-kind sink) > + (map service-kind dependents)))) > + ;; Distinguish COMPOSE and EXTEND because PARAMS= typically > + ;; has a different type than the elements of EXT= ENSIONS. > + (if extend > + (service (service-kind sink) > + (extend params (compose extensions)= )) > + sink)))) I understand the current situation where extensions to a non-extensible service are silently swallowed is suboptimal, but I wonder about the implications of the semantic change here. Currently the =E2=80=9C#t means ensure the service is present=E2=80=9D conv= ention is not enforced; is it even widely followed in the Guix repo? But then, what about repos out there that provide services? It would seem to me that this is something that cannot be changed overnight without running the risk to break people=E2=80=99s code. So perh= aps the first step (and maybe last step?) would be to print a warning. WDYT? Thanks, Ludo=E2=80=99. From debbugs-submit-bounces@debbugs.gnu.org Wed Dec 18 11:32:40 2024 Received: (at control) by debbugs.gnu.org; 18 Dec 2024 16:32:40 +0000 Received: from localhost ([127.0.0.1]:35745 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tNwyW-0004Lu-Cf for submit@debbugs.gnu.org; Wed, 18 Dec 2024 11:32:40 -0500 Received: from eggs.gnu.org ([209.51.188.92]:44388) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tNwyU-0004Lc-6U for control@debbugs.gnu.org; Wed, 18 Dec 2024 11:32:38 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tNwyO-0002Xl-HY for control@debbugs.gnu.org; Wed, 18 Dec 2024 11:32:32 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:Subject:From:To:Date:in-reply-to: references; bh=Wiw1sEFB04p/2eBnh42GSxlbXkp+vaKgFqjme9dLOD0=; b=gv3ceOZZ2iK73v grodPMR04RcmIB9KzE2rTfK8LbuoD3Q11REo7I6POR4wFCft2Wrvl6Sd/0ZvXrvf1Rr9uTWft6+jN vweu7DujoBswwB3Xfll6upWuHyWLV75opyRY//PK2uEMEFRiaRX6+GwfZxJa8Za2RKMXkgEOBgprP E/q4LFJ5y4tc5lRkWJz8gh1+yvtyGmlgYMuV6V1Xir03jfixH3GJZZCgHofSa80zkh7Wuk4DyB/yD z8WPLunEkoPCix1k3WrtOCkyctpP39635z8s7YWu9A69LVXQe/V6pqSaxYASJXOOsK1LFWpQCcWhq lr48KzgPYffTAOIAgQWg==; Date: Wed, 18 Dec 2024 17:32:28 +0100 Message-Id: <87pllpj6jn.fsf@gnu.org> To: control@debbugs.gnu.org From: =?utf-8?Q?Ludovic_Court=C3=A8s?= Subject: control message for bug #71928 MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) tags 71928 + moreinfo quit From unknown Sun Jun 22 00:54:17 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#71928] [PATCH v2] services: Warn when extending services that do not use extensions. References: In-Reply-To: Resent-From: Richard Sent Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 15 Jan 2025 17:10:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 71928 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: moreinfo patch To: 71928@debbugs.gnu.org Cc: ludo@gnu.org, Richard Sent Received: via spool by 71928-submit@debbugs.gnu.org id=B71928.173696097310286 (code B ref 71928); Wed, 15 Jan 2025 17:10:02 +0000 Received: (at 71928) by debbugs.gnu.org; 15 Jan 2025 17:09:33 +0000 Received: from localhost ([127.0.0.1]:58566 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tY6tZ-0002fo-1N for submit@debbugs.gnu.org; Wed, 15 Jan 2025 12:09:33 -0500 Received: from mail-108-mta201.mxroute.com ([136.175.108.201]:33383) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1tY6tV-0002ff-Mc for 71928@debbugs.gnu.org; Wed, 15 Jan 2025 12:09:31 -0500 Received: from filter006.mxroute.com ([136.175.111.3] filter006.mxroute.com) (Authenticated sender: mN4UYu2MZsgR) by mail-108-mta201.mxroute.com (ZoneMTA) with ESMTPSA id 1946af0ffd1000310e.001 for <71928@debbugs.gnu.org> (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384); Wed, 15 Jan 2025 17:09:26 +0000 X-Zone-Loop: 90f2cc6fd184dcd6e24e2eb6c21e8479774c806176ad X-Originating-IP: [136.175.111.3] DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=freakingpenguin.com; s=x; h=Content-Transfer-Encoding:Content-Type: MIME-Version:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=cxcwjoUaOkPJ6yecis8giheV15isl6eWogCACRPw+T8=; b=kFwax3zq7ujyRvTbqXTDrO3Ll5 BgmT/Ft1n/7hxJ9mYwRb8Kpca17MopgEZ5NvIKiiRZ8nszY+06/6eryNW9FuLa7EFPTXeK8fEIVVa TO3up8AZFWZeqPJ1szF0OsW5jv9HAO/IlIafU7J+KsEsI4KY5XnMGNemqQ3a4ysVN6o8UyMiANFn5 iBWDjWifRCb1o+f+ddCMiAQLJmX6TY1ZlN/nbi0XOD+j2U4q5LT495OCtnfA21yy6XgwR0D3QTWx0 NWcRaLE7quxLhuyCsM4bWNHoB7jMkh3WI00ohLqDAXLT1D6btsB9J1py0EyJH2NdC3Cw1xSwZv3Ky cfkZk5Vw==; From: Richard Sent Date: Wed, 15 Jan 2025 12:08:00 -0500 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Authenticated-Id: richard@freakingpenguin.com X-Spam-Score: -1.8 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.8 (--) * gnu/services.scm (fold-services): Add warning when extending a service that does not use extensions. Fixes: https://issues.guix.gnu.org/71887 Change-Id: Ic8d631674bfddde495c93952d9e6cd5649bb287d --- Hi all. Better late than never, right? > Currently the “#t means ensure the service is present” convention is not > enforced; is it even widely followed in the Guix repo? But then, what > about repos out there that provide services? This convention is used for zabbix-front-end-service-type, cuirass-service-type, and cgit-service-type. There might be other services that use a different value in the Guix repo, but I haven't found them yet. > It would seem to me that this is something that cannot be changed > overnight without running the risk to break people’s code. So perhaps > the first step (and maybe last step?) would be to print a warning. Done. This patch has the following limitations: 1. If services A, B, and C all extend unextendable service D, and one of the services doesn't use #t as the value, the warning is printed for A, B, and C. I can't imagine this situation being common and it seems awkward to resolve without needlessly recomputing the extenion value. 2. Extendable services can not be extended with #t to ensure the service is instantiated because #t will be passed to compose/extend and likely throw an error. Not sure of how this should be resolved because a service could always expect to receive a #t from an extension and do some special behavior. In my opinion this is a separate issue. 3. The "#t to ensure an unextendable service is instantiated" convention isn't documented. Given 2 I couldn't find a way to phrase it without it turning into word salad. gnu/services.scm | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/gnu/services.scm b/gnu/services.scm index 8a4002e072..2e012ff028 100644 --- a/gnu/services.scm +++ b/gnu/services.scm @@ -9,6 +9,7 @@ ;;; Copyright © 2022 Tobias Geerinckx-Rice ;;; Copyright © 2023 Brian Cully ;;; Copyright © 2024 Nicolas Graves +;;; Copyright © 2025 Richard Sent ;;; ;;; This file is part of GNU Guix. ;;; @@ -1250,12 +1251,26 @@ (define* (fold-services services (params -> (service-value sink)) (service -> - ;; Distinguish COMPOSE and EXTEND because PARAMS typically - ;; has a different type than the elements of EXTENSIONS. - (if extend - (service (service-kind sink) - (extend params (compose extensions))) - sink))) + (begin + (unless (or (null? extensions) + ;; Extending an unextendable service with + ;; a value of #t is a convention for "make + ;; sure the service is present." + (every (cut eq? #t <>) extensions) + (and extend compose)) + (warning + ;; XXX: This warning lists all dependents even if + ;; only one dependent extends with a non-#t value. + (G_ "Extensions are not supported in \ +~a yet the following service types extend it:~{~% ~a~}~%") + (service-kind sink) + (map service-kind dependents))) + ;; Distinguish COMPOSE and EXTEND because PARAMS typically + ;; has a different type than the elements of EXTENSIONS. + (if extend + (service (service-kind sink) + (extend params (compose extensions))) + sink)))) (mbegin %state-monad (set-current-state (vhash-consq sink service visited)) (return service)))) base-commit: b696658ee8e0655b17f5d26e024956b5148e36d6 -- 2.47.1