From unknown Sat Aug 09 18:42:55 2025 X-Loop: help-debbugs@gnu.org Subject: bug#71887: Raise an error when extending a service type that doesn't support extensions Resent-From: Richard Sent Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Mon, 01 Jul 2024 22:11:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 71887 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: 71887@debbugs.gnu.org X-Debbugs-Original-To: bug-guix@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.171987184328840 (code B ref -1); Mon, 01 Jul 2024 22:11:02 +0000 Received: (at submit) by debbugs.gnu.org; 1 Jul 2024 22:10:43 +0000 Received: from localhost ([127.0.0.1]:35005 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sOPER-0007V5-3R for submit@debbugs.gnu.org; Mon, 01 Jul 2024 18:10:43 -0400 Received: from lists.gnu.org ([209.51.188.17]:39920) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sOPEO-0007Uw-Po for submit@debbugs.gnu.org; Mon, 01 Jul 2024 18:10:41 -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 1sOPEN-00053f-Lb for bug-guix@gnu.org; Mon, 01 Jul 2024 18:10:39 -0400 Received: from mail-108-mta114.mxroute.com ([136.175.108.114]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sOPEL-00080i-7P for bug-guix@gnu.org; Mon, 01 Jul 2024 18:10:39 -0400 Received: from filter006.mxroute.com ([136.175.111.3] filter006.mxroute.com) (Authenticated sender: mN4UYu2MZsgR) by mail-108-mta114.mxroute.com (ZoneMTA) with ESMTPSA id 19070597c2300017a3.001 for (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384); Mon, 01 Jul 2024 22:10:31 +0000 X-Zone-Loop: 6cf732c21d9ba4a0574335b52e789ab5db6d013c1ef8 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-Type:MIME-Version:Message-ID:Date: Subject:To:From:Sender:Reply-To:Cc:Content-Transfer-Encoding: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=P/7+yKseN0WFttFqK+M1My+09VFz3lTZ/XFv6XCbZwo=; b=r/VDD9zjMXsiaVsaGWEvo+9RDI yoBYnatDH+X5mo3uklk4C4WD9LxGUB5Y02bfN1REpeVEjRa14xMK2yidIZIiNn5SE1YmKsBVr1MBb eGoPRdHWDA1Do8UK7ms8Lnetq0foJ5Lh0mtRVTkBdbAkktLKSC3uTPt2VCA/d0UGj08M6x9njvIld 1oqcUpv+KBzlF2nZWX+sa3hBiM/gL13h2c03YfqgmY9Zy/s6lnWsis+FfyLBFz0f488XIjy5Gq787 /yNYlEMB99p8Cg+qXgezlW74oQvkb1UufB3+Yss54wlY4mpn9jQfMx/fmT6Naggjg4u57vxHZR5Hn QRO7H/4g==; From: Richard Sent Date: Mon, 01 Jul 2024 18:10:27 -0400 Message-ID: <877ce4dar0.fsf@freakingpenguin.com> MIME-Version: 1.0 Content-Type: text/plain X-Authenticated-Id: richard@freakingpenguin.com Received-SPF: pass client-ip=136.175.108.114; envelope-from=richard@freakingpenguin.com; helo=mail-108-mta114.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, RCVD_IN_DNSWL_NONE=-0.0001, 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 (--) Hi Guix, At present it is possible to extend service-types that do not implement compose or extend methods, resulting in surprising behavior that's hard to debug [1]. We should throw an error when a service-type that does not have compose or extend fields is extended. --8<---------------cut here---------------start------------->8--- (use-modules (gnu home) (gnu home services) (gnu home services desktop) (gnu services)) (home-environment (services (list ;; home-redshift-service-type does not support extensions (simple-service 'this-should-error home-redshift-service-type "According to all known laws of aviation...")))) --8<---------------cut here---------------end--------------->8--- [1]: https://lists.gnu.org/archive/html/help-guix/2024-07/msg00000.html -- Take it easy, Richard Sent Making my computer weirder one commit at a time. From unknown Sat Aug 09 18:42:55 2025 X-Loop: help-debbugs@gnu.org Subject: bug#71887: Raise an error when extending a service type that doesn't support extensions Resent-From: Richard Sent Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Tue, 02 Jul 2024 03:37:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 71887 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: 71887@debbugs.gnu.org Received: via spool by 71887-submit@debbugs.gnu.org id=B71887.17198914026015 (code B ref 71887); Tue, 02 Jul 2024 03:37:01 +0000 Received: (at 71887) by debbugs.gnu.org; 2 Jul 2024 03:36:42 +0000 Received: from localhost ([127.0.0.1]:35367 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sOUJu-0001Yw-BC for submit@debbugs.gnu.org; Mon, 01 Jul 2024 23:36:42 -0400 Received: from mail-108-mta4.mxroute.com ([136.175.108.4]:33657) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sOUJr-0001Yn-Jc for 71887@debbugs.gnu.org; Mon, 01 Jul 2024 23:36:40 -0400 Received: from filter006.mxroute.com ([136.175.111.3] filter006.mxroute.com) (Authenticated sender: mN4UYu2MZsgR) by mail-108-mta4.mxroute.com (ZoneMTA) with ESMTPSA id 190718407c100017a3.001 for <71887@debbugs.gnu.org> (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384); Tue, 02 Jul 2024 03:36:36 +0000 X-Zone-Loop: fac88e882360878eca6a35a97fb473303f2c4d5d380b 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-Type:MIME-Version:Message-ID:Date: References:In-Reply-To:Subject:To:From:Sender:Reply-To:Cc: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=/RBbm3LE5YObA6CvcVcLu9peUH7R2XS5tmgMe5mwVr0=; b=oM5kclxccvukdR7GzSaSto2WZ6 JP1tgHY3fV92azr9Qidk9cZ6EhaX1AcTVRJDum5d344PFr1Uoo4a401P8+hYvKUXjQ7Ygs3RNXt3K TJ7UlKe+lQxh6U/PuCI3+plT0CCywxOegRNjLmek3WyvENZGhkyHzN9V9G7Ls7Yyoet9VOzTLiKY9 Q8aqTfyAhXUV9Ga215ipIfo1OHVIa1kBCQboN24OiG0M5MOzxzk8bSecxf7pInTm/fZ9ajn+zx+eM GUtXNWstyhqow7NwMFd6+UaqjNo1qjY2BFEjd7+EFuDfycpofEELFeV/g1vRHmF87CRjqlOB93j1u zvN/4eSQ==; From: Richard Sent In-Reply-To: <877ce4dar0.fsf@freakingpenguin.com> (Richard Sent's message of "Mon, 01 Jul 2024 18:10:27 -0400") References: <877ce4dar0.fsf@freakingpenguin.com> User-Agent: Gnus/5.13 (Gnus v5.13) Date: Mon, 01 Jul 2024 23:36:29 -0400 Message-ID: <87cynwbh36.fsf@freakingpenguin.com> MIME-Version: 1.0 Content-Type: text/plain 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 (-) I've started looking into this issue and came up with the following diff: --8<---------------cut here---------------start------------->8--- diff --git a/gnu/services.scm b/gnu/services.scm index 88593e8091..e7e2da6ad5 100644 --- a/gnu/services.scm +++ b/gnu/services.scm @@ -1225,10 +1225,17 @@ (define* (fold-services services -> ;; Distinguish COMPOSE and EXTEND because PARAMS typically ;; has a different type than the elements of EXTENSIONS. - (if extend + (begin + (unless (or (null? extensions) + (and extend compose)) + (error (format #f "Extensions are not supported in ~a \ +yet the following extensions were found: ~a~%" + (service-kind sink) + dependents))) + (if extend (service (service-kind sink) (extend params (compose extensions))) - sink))) + sink)))) (mbegin %state-monad (set-current-state (vhash-consq sink service visited)) (return service)))) --8<---------------cut here---------------end--------------->8--- Unfortunately this approach isn't sufficient. In certain cases services intentionally extend other services to ensure they're instantiated even when the service is unused. For example, --8<---------------cut here---------------start------------->8--- (define cgit-service-type (service-type (name 'cgit) (extensions (list ... ;; Make sure fcgiwrap is instantiated. (service-extension fcgiwrap-service-type (const #t)))) ... (default-value (cgit-configuration)))) --8<---------------cut here---------------end--------------->8--- If we all agree that "make sure X is instantiated" service-extensions must use (const #t), then the above diff can work with minimal modifications (if every extension value is #t, valid). I'll see if I can find where to document this when I create the full patch. If not, I do not believe this bug is solvable. Any service can be extended with any value regardless of whether that value is used or coherent. Ergo there's no way to check if any particular extension is valid. $ make check-system TESTS=cgit is a good way to verify behavior in this context. -- Take it easy, Richard Sent Making my computer weirder one commit at a time.