From unknown Sat Jul 26 02:32:02 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#69340] [PATCH] system, home: Validate =?UTF-8?Q?=E2=80=98services=E2=80=99?= field value. Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: , guix-patches@gnu.org Resent-Date: Fri, 23 Feb 2024 21:16:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 69340 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 69340@debbugs.gnu.org Cc: Ludovic =?UTF-8?Q?Court=C3=A8s?= , ( , Andrew Tropin , Ludovic =?UTF-8?Q?Court=C3=A8s?= X-Debbugs-Original-To: guix-patches@gnu.org X-Debbugs-Original-Xcc: ( , Andrew Tropin , Ludovic =?UTF-8?Q?Court=C3=A8s?= Received: via spool by submit@debbugs.gnu.org id=B.17087229273919 (code B ref -1); Fri, 23 Feb 2024 21:16:02 +0000 Received: (at submit) by debbugs.gnu.org; 23 Feb 2024 21:15:27 +0000 Received: from localhost ([127.0.0.1]:43860 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rdct8-00010q-As for submit@debbugs.gnu.org; Fri, 23 Feb 2024 16:15:27 -0500 Received: from lists.gnu.org ([209.51.188.17]:44718) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rdct3-00010M-1j for submit@debbugs.gnu.org; Fri, 23 Feb 2024 16:15:20 -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 1rdcC0-000757-DI for guix-patches@gnu.org; Fri, 23 Feb 2024 15:30:48 -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 1rdcBz-0002ns-BH; Fri, 23 Feb 2024 15:30:47 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:Subject:To:From:in-reply-to: references; bh=UO+REeyKvVv8buh5KPDFicZzbpQxs8iFjbfpHcLQ8Us=; b=Jml4xFrWy+r7dw bYaVshGDZMz1+wo2TlJ0ugWupHNf3pzxirov26TMhDwVUu0R/6CMNgwP/YKT7pua97TeoDaQP4eL3 7FOyk1fftfyXJ/uwA33FhD5NaeS4m4504K356NbpPeyJOT87tdWTotqBSYVFxZ2yRCeZADTdICwfk UCDWOgE44CYMYB4ILOx8CRCH62Z2ByxQtKdGRnmGcZxQcJt2Jcn0+BkXkVYpUvuBCCXuMVfTXAloE 3PL1abn88lCruFYA2R8QOW1H3A97wrJSM3zS0fTqUXjqAhvwgVYhzs/fHRL3cD5VMGt2PrylL5DtK VEuXIMgOxGejGF6eX3sw==; From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Date: Fri, 23 Feb 2024 21:30:34 +0100 Message-ID: X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) 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 (---) This guides newcomers who might stick a single (service …) form in this field. * gnu/services.scm (validate-service-list): New macro. (%validate-service-list): New procedure. * gnu/system.scm ()[services]: Add ‘sanitize’. * gnu/home.scm ()[services]: Add ‘sanitize’. Change-Id: I9e29bd9a078e87b627ab766fd669ba9de79f8473 --- gnu/home.scm | 5 +++-- gnu/services.scm | 19 ++++++++++++++++++- gnu/system.scm | 5 +++-- 3 files changed, 24 insertions(+), 5 deletions(-) Hi! The goal here is to recognize this likely pitfall for newcomers and to guide them. Thoughts? Ludo'. diff --git a/gnu/home.scm b/gnu/home.scm index 2fefe7ba53..b390c8d534 100644 --- a/gnu/home.scm +++ b/gnu/home.scm @@ -1,6 +1,6 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2021 Andrew Tropin -;;; Copyright © 2022 Ludovic Courtès +;;; Copyright © 2022, 2024 Ludovic Courtès ;;; ;;; This file is part of GNU Guix. ;;; @@ -67,7 +67,8 @@ (define-record-type* home-environment this-home-environment))) (services home-environment-user-services - (default '())) + (default '()) + (sanitize validate-service-list)) (location home-environment-location ; (default (and=> (current-source-location) diff --git a/gnu/services.scm b/gnu/services.scm index 59481af10f..88593e8091 100644 --- a/gnu/services.scm +++ b/gnu/services.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2015-2023 Ludovic Courtès +;;; Copyright © 2015-2024 Ludovic Courtès ;;; Copyright © 2016 Chris Marusich ;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen ;;; Copyright © 2020, 2021 Ricardo Wurmus @@ -91,6 +91,8 @@ (define-module (gnu services) for-home for-home? + validate-service-list + service-error? missing-value-service-error? missing-value-service-error-type @@ -1271,4 +1273,19 @@ (define-syntax-rule (for-home exp ...) (syntax-parameterize ((for-home? (identifier-syntax #t))) exp ...)) +(define-with-syntax-properties (validate-service-list (value properties)) + (%validate-service-list value properties)) + +(define (%validate-service-list value properties) + (match value + (((? service?) ...) value) + (_ + (raise + (make-compound-condition + (condition + (&error-location + (location (source-properties->location properties)))) + (formatted-message + (G_ "'services' field must contain a list of services"))))))) + ;;; services.scm ends here. diff --git a/gnu/system.scm b/gnu/system.scm index aede35775e..aef81d8ccf 100644 --- a/gnu/system.scm +++ b/gnu/system.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2013-2022 Ludovic Courtès +;;; Copyright © 2013-2022, 2024 Ludovic Courtès ;;; Copyright © 2015 Mark H Weaver ;;; Copyright © 2015, 2016 Alex Kost ;;; Copyright © 2016 Chris Marusich @@ -294,7 +294,8 @@ (define-record-type* operating-system this-operating-system))) (services operating-system-user-services ; list of services (thunked) ;allow for system-dependent services - (default %base-services)) + (default %base-services) + (sanitize validate-service-list)) (pam-services operating-system-pam-services ; list of PAM services (default (base-pam-services))) base-commit: b386c11e7804e0b577411d930b60f1e0a4a0382c -- 2.41.0 From unknown Sat Jul 26 02:32:02 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Ludovic =?UTF-8?Q?Court=C3=A8s?= Subject: bug#69340: closed (Re: [bug#69340] [PATCH] system, home: Validate =?UTF-8?Q?=E2=80=98services=E2=80=99?= field value.) Message-ID: References: <87ttkysg15.fsf@gnu.org> X-Gnu-PR-Message: they-closed 69340 X-Gnu-PR-Package: guix-patches X-Gnu-PR-Keywords: patch Reply-To: 69340@debbugs.gnu.org Date: Fri, 22 Mar 2024 10:54:04 +0000 Content-Type: multipart/mixed; boundary="----------=_1711104844-5903-1" This is a multi-part message in MIME format... ------------=_1711104844-5903-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #69340: [PATCH] system, home: Validate =E2=80=98services=E2=80=99 field va= lue. which was filed against the guix-patches package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 69340@debbugs.gnu.org. --=20 69340: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D69340 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1711104844-5903-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 69340-done) by debbugs.gnu.org; 22 Mar 2024 10:53:59 +0000 Received: from localhost ([127.0.0.1]:42561 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rncX9-0001W7-2m for submit@debbugs.gnu.org; Fri, 22 Mar 2024 06:53:59 -0400 Received: from eggs.gnu.org ([209.51.188.92]:39862) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rncX3-0001Ul-En for 69340-done@debbugs.gnu.org; Fri, 22 Mar 2024 06:53:53 -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 1rncN8-0003Mj-0G; Fri, 22 Mar 2024 06:43:38 -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=yCyaWbZI0bNW9eIOf1uKBRPNMj8TkhY8JhwXo7jNVeE=; b=MnrgQe5Age2zVhy+CArS POBgaSVYZu9bKaXbufWZYkr4YKkMvdap+xufQVQ4++yOlm7L2ibk1Pz1QFasr0828ePnyK1et/4NX A3POPeSws6TxZtGdecke7kPVh7GJxj1a7PApevEtzW/FnOjRSqz0q/2z2nQBdbDkMsBZN9ntCK7g4 uGCCI97l+922lXJY5XS9mfXZP/lPshlxowYexaVw/3tvJLCJIK6ylRL2/5fG7MztrB81EjVU8oje8 N5QATKnwpm9FMuRjS7/lkktP7OpE64850N3RXsWn43TVs9/DfHPklj7mXOcCsFneasvjt1/UcGBbX SH7Squgnxn3kZg==; From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: 69340-done@debbugs.gnu.org Subject: Re: [bug#69340] [PATCH] system, home: Validate =?utf-8?B?4oCY?= =?utf-8?B?c2VydmljZXPigJk=?= field value. In-Reply-To: ("Ludovic =?utf-8?Q?Court=C3=A8s=22's?= message of "Fri, 23 Feb 2024 21:30:34 +0100") References: Date: Fri, 22 Mar 2024 11:43:34 +0100 Message-ID: <87ttkysg15.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: -2.3 (--) X-Debbugs-Envelope-To: 69340-done Cc: paren@disroot.org, Andrew Tropin 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 (---) Ludovic Court=C3=A8s skribis: > This guides newcomers who might stick a single (service =E2=80=A6) form > in this field. > > * gnu/services.scm (validate-service-list): New macro. > (%validate-service-list): New procedure. > * gnu/system.scm ()[services]: Add =E2=80=98sanitize=E2= =80=99. > * gnu/home.scm ()[services]: Add =E2=80=98sanitize=E2= =80=99. > > Change-Id: I9e29bd9a078e87b627ab766fd669ba9de79f8473 Pushed as 29de2edfbbed21ac016f73a45d399795fc2e4dfb. Ludo=E2=80=99. ------------=_1711104844-5903-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 23 Feb 2024 21:15:27 +0000 Received: from localhost ([127.0.0.1]:43860 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rdct8-00010q-As for submit@debbugs.gnu.org; Fri, 23 Feb 2024 16:15:27 -0500 Received: from lists.gnu.org ([209.51.188.17]:44718) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rdct3-00010M-1j for submit@debbugs.gnu.org; Fri, 23 Feb 2024 16:15:20 -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 1rdcC0-000757-DI for guix-patches@gnu.org; Fri, 23 Feb 2024 15:30:48 -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 1rdcBz-0002ns-BH; Fri, 23 Feb 2024 15:30:47 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:Subject:To:From:in-reply-to: references; bh=UO+REeyKvVv8buh5KPDFicZzbpQxs8iFjbfpHcLQ8Us=; b=Jml4xFrWy+r7dw bYaVshGDZMz1+wo2TlJ0ugWupHNf3pzxirov26TMhDwVUu0R/6CMNgwP/YKT7pua97TeoDaQP4eL3 7FOyk1fftfyXJ/uwA33FhD5NaeS4m4504K356NbpPeyJOT87tdWTotqBSYVFxZ2yRCeZADTdICwfk UCDWOgE44CYMYB4ILOx8CRCH62Z2ByxQtKdGRnmGcZxQcJt2Jcn0+BkXkVYpUvuBCCXuMVfTXAloE 3PL1abn88lCruFYA2R8QOW1H3A97wrJSM3zS0fTqUXjqAhvwgVYhzs/fHRL3cD5VMGt2PrylL5DtK VEuXIMgOxGejGF6eX3sw==; From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= To: guix-patches@gnu.org Subject: [PATCH] =?UTF-8?q?system, =20home:=20Validate=20=E2=80=98services?= =?UTF-8?q?=E2=80=99=20field=20value.?= Date: Fri, 23 Feb 2024 21:30:34 +0100 Message-ID: X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Debbugs-Cc: ( , Andrew Tropin , Ludovic Courtès Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: submit Cc: =?UTF-8?q?Ludovic=20Court=C3=A8s?= 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 (---) This guides newcomers who might stick a single (service …) form in this field. * gnu/services.scm (validate-service-list): New macro. (%validate-service-list): New procedure. * gnu/system.scm ()[services]: Add ‘sanitize’. * gnu/home.scm ()[services]: Add ‘sanitize’. Change-Id: I9e29bd9a078e87b627ab766fd669ba9de79f8473 --- gnu/home.scm | 5 +++-- gnu/services.scm | 19 ++++++++++++++++++- gnu/system.scm | 5 +++-- 3 files changed, 24 insertions(+), 5 deletions(-) Hi! The goal here is to recognize this likely pitfall for newcomers and to guide them. Thoughts? Ludo'. diff --git a/gnu/home.scm b/gnu/home.scm index 2fefe7ba53..b390c8d534 100644 --- a/gnu/home.scm +++ b/gnu/home.scm @@ -1,6 +1,6 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2021 Andrew Tropin -;;; Copyright © 2022 Ludovic Courtès +;;; Copyright © 2022, 2024 Ludovic Courtès ;;; ;;; This file is part of GNU Guix. ;;; @@ -67,7 +67,8 @@ (define-record-type* home-environment this-home-environment))) (services home-environment-user-services - (default '())) + (default '()) + (sanitize validate-service-list)) (location home-environment-location ; (default (and=> (current-source-location) diff --git a/gnu/services.scm b/gnu/services.scm index 59481af10f..88593e8091 100644 --- a/gnu/services.scm +++ b/gnu/services.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2015-2023 Ludovic Courtès +;;; Copyright © 2015-2024 Ludovic Courtès ;;; Copyright © 2016 Chris Marusich ;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen ;;; Copyright © 2020, 2021 Ricardo Wurmus @@ -91,6 +91,8 @@ (define-module (gnu services) for-home for-home? + validate-service-list + service-error? missing-value-service-error? missing-value-service-error-type @@ -1271,4 +1273,19 @@ (define-syntax-rule (for-home exp ...) (syntax-parameterize ((for-home? (identifier-syntax #t))) exp ...)) +(define-with-syntax-properties (validate-service-list (value properties)) + (%validate-service-list value properties)) + +(define (%validate-service-list value properties) + (match value + (((? service?) ...) value) + (_ + (raise + (make-compound-condition + (condition + (&error-location + (location (source-properties->location properties)))) + (formatted-message + (G_ "'services' field must contain a list of services"))))))) + ;;; services.scm ends here. diff --git a/gnu/system.scm b/gnu/system.scm index aede35775e..aef81d8ccf 100644 --- a/gnu/system.scm +++ b/gnu/system.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2013-2022 Ludovic Courtès +;;; Copyright © 2013-2022, 2024 Ludovic Courtès ;;; Copyright © 2015 Mark H Weaver ;;; Copyright © 2015, 2016 Alex Kost ;;; Copyright © 2016 Chris Marusich @@ -294,7 +294,8 @@ (define-record-type* operating-system this-operating-system))) (services operating-system-user-services ; list of services (thunked) ;allow for system-dependent services - (default %base-services)) + (default %base-services) + (sanitize validate-service-list)) (pam-services operating-system-pam-services ; list of PAM services (default (base-pam-services))) base-commit: b386c11e7804e0b577411d930b60f1e0a4a0382c -- 2.41.0 ------------=_1711104844-5903-1--