From unknown Fri Jun 20 07:19:24 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#62298] [PATCH 0/8] Extensible define-configuration & mpd/mympd service fixes Resent-From: Bruno Victal Original-Sender: "Debbugs-submit" Resent-CC: liliana.prikler@gmail.com, maxim.cournoyer@gmail.com, ludo@gnu.org, guix-patches@gnu.org Resent-Date: Mon, 20 Mar 2023 16:47:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 62298 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 62298@debbugs.gnu.org Cc: Bruno Victal , liliana.prikler@gmail.com, maxim.cournoyer@gmail.com, ludo@gnu.org X-Debbugs-Original-To: guix-patches@gnu.org X-Debbugs-Original-Xcc: liliana.prikler@gmail.com, maxim.cournoyer@gmail.com, ludo@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.16793307789062 (code B ref -1); Mon, 20 Mar 2023 16:47:01 +0000 Received: (at submit) by debbugs.gnu.org; 20 Mar 2023 16:46:18 +0000 Received: from localhost ([127.0.0.1]:55594 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1peIeI-0002M6-20 for submit@debbugs.gnu.org; Mon, 20 Mar 2023 12:46:18 -0400 Received: from lists.gnu.org ([209.51.188.17]:51044) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1peIeG-0002Lw-LL for submit@debbugs.gnu.org; Mon, 20 Mar 2023 12:46:16 -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 1peIeG-0000Zq-DJ for guix-patches@gnu.org; Mon, 20 Mar 2023 12:46:16 -0400 Received: from smtpmciv3.myservices.hosting ([185.26.107.239]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1peIe9-0006xf-KT for guix-patches@gnu.org; Mon, 20 Mar 2023 12:46:16 -0400 Received: from mail1.netim.hosting (unknown [185.26.106.173]) by smtpmciv3.myservices.hosting (Postfix) with ESMTP id BA0CB20407 for ; Mon, 20 Mar 2023 17:45:58 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by mail1.netim.hosting (Postfix) with ESMTP id 682B280098; Mon, 20 Mar 2023 17:45:58 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at mail1.netim.hosting Received: from mail1.netim.hosting ([127.0.0.1]) by localhost (mail1-2.netim.hosting [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id 3PYLzLgXaX8n; Mon, 20 Mar 2023 17:45:56 +0100 (CET) Received: from guix-nuc.home.arpa (bl9-119-177.dsl.telepac.pt [85.242.119.177]) (Authenticated sender: lumen@makinata.eu) by mail1.netim.hosting (Postfix) with ESMTPSA id 37C8280079; Mon, 20 Mar 2023 17:45:56 +0100 (CET) From: Bruno Victal Date: Mon, 20 Mar 2023 16:45:47 +0000 Message-Id: X-Mailer: git-send-email 2.39.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=185.26.107.239; envelope-from=mirai@makinata.eu; helo=smtpmciv3.myservices.hosting X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.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: -2.3 (--) Highlights: * Make define-configuration extensible. define-configuration can now have extra fields where custom-serializer was located. * New literals: sanitizer, serializer. Support user-specified sanitizers. * Fixes . * Switch to user-account/group for mympd-service-type as well. * Make mpd-service-type with pulseaudio usable out-of-the-box. * Fix a mympd-service-type when logging with syslog. Bruno Victal (8): services: configuration: Add user-defined sanitizer support. services: replace bare serializers with (serializer ...) services: audio: remove redundant list-of-string? predicate. services: mympd: Require 'syslog service when configured to log to syslog. services: mpd: Fix unintentional API breakage for mixer-type field. services: mpd: Set PulseAudio related variables as default value for environment-variables field. services: mpd: Use user-account (resp. user-group) for user (resp. group) fields. services: mympd: Use user-account (resp. user-group) for user (resp. group) fields. doc/guix.texi | 46 +++++-- gnu/home/services/shells.scm | 12 +- gnu/services/audio.scm | 224 ++++++++++++++++++++++--------- gnu/services/configuration.scm | 97 ++++++++++--- gnu/services/security.scm | 6 +- tests/services/configuration.scm | 156 ++++++++++++++++++++- 6 files changed, 431 insertions(+), 110 deletions(-) -- 2.39.1 From unknown Fri Jun 20 07:19:24 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#62298] [PATCH 1/8] services: configuration: Add user-defined sanitizer support. Resent-From: Bruno Victal Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 20 Mar 2023 17:08:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 62298 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 62298@debbugs.gnu.org Cc: ludo@gnu.org, Bruno Victal , liliana.prikler@gmail.com, maxim.cournoyer@gmail.com Received: via spool by 62298-submit@debbugs.gnu.org id=B62298.167933204211455 (code B ref 62298); Mon, 20 Mar 2023 17:08:02 +0000 Received: (at 62298) by debbugs.gnu.org; 20 Mar 2023 17:07:22 +0000 Received: from localhost ([127.0.0.1]:55631 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1peIyf-0002yf-0a for submit@debbugs.gnu.org; Mon, 20 Mar 2023 13:07:22 -0400 Received: from smtpmciv2.myservices.hosting ([185.26.107.238]:50986) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1peIyb-0002yI-Ub for 62298@debbugs.gnu.org; Mon, 20 Mar 2023 13:07:19 -0400 Received: from mail1.netim.hosting (unknown [185.26.106.173]) by smtpmciv2.myservices.hosting (Postfix) with ESMTP id 2BE0B20CBD; Mon, 20 Mar 2023 18:07:15 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by mail1.netim.hosting (Postfix) with ESMTP id D326C8009E; Mon, 20 Mar 2023 18:07:15 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at mail1.netim.hosting Received: from mail1.netim.hosting ([127.0.0.1]) by localhost (mail1-2.netim.hosting [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id u7dsVyVageXQ; Mon, 20 Mar 2023 18:07:14 +0100 (CET) Received: from guix-nuc.home.arpa (bl9-119-177.dsl.telepac.pt [85.242.119.177]) (Authenticated sender: lumen@makinata.eu) by mail1.netim.hosting (Postfix) with ESMTPSA id 404918009B; Mon, 20 Mar 2023 18:07:14 +0100 (CET) From: Bruno Victal Date: Mon, 20 Mar 2023 17:07:06 +0000 Message-Id: <2f7b29de4dacdee7e60ede8830a67c643122c302.1679332019.git.mirai@makinata.eu> X-Mailer: git-send-email 2.39.1 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 (-) This changes the 'custom-serializer' field into a generic 'extra-args' field that can be extended to support new literals. With this mechanism, the literals 'sanitizer' allow for user-defined sanitizer procedures while the 'serializer' literal is used for custom serializer procedures. The 'empty-serializer' was also added as a 'literal' and can be used just like it was previously. With the repurposing of 'custom-serializer' into 'extra-args', to prevent intolerable confusion, the custom serializer procedures should be specified using the new 'literals' approach, with the previous “style” being considered as deprecated. * gnu/services/configuration.scm (define-configuration-helper): Rename 'custom-serializer' to 'extra-args'. Add support for literals 'sanitizer', 'serializer' and 'empty-serializer'. Rename procedure 'field-sanitizer' to 'default-field-sanitizer' to avoid syntax clash. Only define default field sanitizers if user-defined ones are absent. (deprecated-style-serializer?): New predicate. (get-sanitizer, get-serializer): New procedure. ()[sanitizer]: New field. * doc/guix.texi (Complex Configurations): Document the newly added literals. * tests/services/configuration.scm: Add tests for the new literals. --- doc/guix.texi | 30 ++++++- gnu/services/configuration.scm | 97 ++++++++++++++++----- tests/services/configuration.scm | 145 ++++++++++++++++++++++++++++++- 3 files changed, 247 insertions(+), 25 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index fa9ea5a6ec..f84cadeeda 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -41127,7 +41127,7 @@ Complex Configurations (@var{field-name} (@var{type} @var{default-value}) @var{documentation} - @var{serializer}) + (serializer @var{serializer})) (@var{field-name} (@var{type}) @@ -41136,7 +41136,18 @@ Complex Configurations (@var{field-name} (@var{type}) @var{documentation} - @var{serializer}) + (serializer @var{serializer})) + +(@var{field-name} + (@var{type}) + @var{documentation} + (sanitizer @var{sanitizer}) + +(@var{field-name} + (@var{type}) + @var{documentation} + (sanitizer @var{sanitizer}) + (serializer @var{serializer})) @end example @var{field-name} is an identifier that denotes the name of the field in @@ -41159,6 +41170,21 @@ Complex Configurations @var{documentation} is a string formatted with Texinfo syntax which should provide a description of what setting this field does. +@var{sanitizer} is the name of a procedure which takes one argument, +a user-supplied value, and returns a ``sanitized'' value for the field. +If none is specified, the predicate @code{@var{type}?} is automatically +used to construct an internal sanitizer that asserts the type correctness +of the field value. + +An example of a sanitizer for a field that accepts both strings and +symbols looks like this: +@lisp +(define (sanitize-foo value) + (cond ((string? value) value) + ((symbol? value) (symbol->string value)) + (else (throw 'bad! value)))) +@end lisp + @var{serializer} is the name of a procedure which takes two arguments, the first is the name of the field, and the second is the value corresponding to the field. The procedure should return a string or diff --git a/gnu/services/configuration.scm b/gnu/services/configuration.scm index 02d1aa1796..6ad9ade76d 100644 --- a/gnu/services/configuration.scm +++ b/gnu/services/configuration.scm @@ -6,6 +6,7 @@ ;;; Copyright © 2021, 2022 Maxim Cournoyer ;;; Copyright © 2021 Andrew Tropin ;;; Copyright © 2022 Maxime Devos +;;; Copyright © 2023 Bruno Victal ;;; ;;; This file is part of GNU Guix. ;;; @@ -28,7 +29,8 @@ (define-module (gnu services configuration) #:use-module (guix gexp) #:use-module ((guix utils) #:select (source-properties->location)) #:use-module ((guix diagnostics) - #:select (formatted-message location-file &error-location)) + #:select (formatted-message location-file &error-location + warning)) #:use-module ((guix modules) #:select (file-name->module-name)) #:use-module (guix i18n) #:autoload (texinfo) (texi-fragment->stexi) @@ -44,6 +46,7 @@ (define-module (gnu services configuration) configuration-field-type configuration-missing-field configuration-field-error + configuration-field-sanitizer configuration-field-serializer configuration-field-getter configuration-field-default-value-thunk @@ -116,6 +119,7 @@ (define-record-type* (type configuration-field-type) (getter configuration-field-getter) (predicate configuration-field-predicate) + (sanitizer configuration-field-sanitizer) (serializer configuration-field-serializer) (default-value-thunk configuration-field-default-value-thunk) (documentation configuration-field-documentation)) @@ -181,8 +185,46 @@ (define (normalize-field-type+def s) (values #'(field-type %unset-value))))) (define (define-configuration-helper serialize? serializer-prefix syn) + + (define (deprecated-style-serializer? s) + ;; TODO: helper for deprecated style, remove later. + (syntax-case s () + ;; Case 1. Nothing after 'doc'. + (() #f) + ;; Case 2. Bare serializer after 'doc'. [deprecated] + ;; Until this case is removed, don't forget to add a check for your + ;; newly added field/literal here. + (proc + (not (or (maybe-value-set? (get-serializer s)) + (maybe-value-set? (get-sanitizer s)))) + (begin + (warning #f (G_ "specifying serializers after documentation is \ +deprecated, use (serializer ~a) instead~%") (car (syntax->datum #'proc))) #t)) + ;; Else, something after 'doc' in the updated style. + (else #f))) + + ;; The get-… procedures perform scanning to @var{extra-args} to allow for + ;; newly added fields to be specified in arbitrary order. + (define (get-sanitizer s) + (syntax-case s (sanitizer) + (((sanitizer proc) _ ...) + #'proc) + ((_ tail ...) + (get-sanitizer #'(tail ...))) + (() %unset-value))) + + (define (get-serializer s) + (syntax-case s (serializer empty-serializer) + (((serializer proc) _ ...) + #'proc) + ((empty-serializer _ ...) + #'empty-serializer) + ((_ tail ...) + (get-serializer #'(tail ...))) + (() %unset-value))) + (syntax-case syn () - ((_ stem (field field-type+def doc custom-serializer ...) ...) + ((_ stem (field field-type+def doc extra-args ...) ...) (with-syntax ((((field-type def) ...) (map normalize-field-type+def #'(field-type+def ...)))) @@ -200,21 +242,23 @@ (define (define-configuration-helper serialize? serializer-prefix syn) ((field-type default-value) default-value)) #'((field-type def) ...))) + ((field-sanitizer ...) + (map (compose maybe-value get-sanitizer) + #'((extra-args ...) ...))) ((field-serializer ...) - (map (lambda (type custom-serializer) + (map (lambda (type extra-args) (and serialize? - (match custom-serializer - ((serializer) - serializer) - (() - (if serializer-prefix - (id #'stem - serializer-prefix - #'serialize- type) - (id #'stem #'serialize- type)))))) + (or + (if (deprecated-style-serializer? extra-args) + (car extra-args) ; strip outer parenthesis + #f) + (maybe-value (get-serializer extra-args)) + (if serializer-prefix + (id #'stem serializer-prefix #'serialize- type) + (id #'stem #'serialize- type))))) #'(field-type ...) - #'((custom-serializer ...) ...)))) - (define (field-sanitizer name pred) + #'((extra-args ...) ...)))) + (define (default-field-sanitizer name pred) ;; Define a macro for use as a record field sanitizer, where NAME ;; is the name of the field and PRED is the predicate that tells ;; whether a value is valid for this field. @@ -235,21 +279,29 @@ (define (define-configuration-helper serialize? serializer-prefix syn) #`(begin ;; Define field validation macros. - #,@(map field-sanitizer - #'(field ...) - #'(field-predicate ...)) + #,@(filter-map (lambda (name pred sanitizer) + (if sanitizer + #f + (default-field-sanitizer name pred))) + #'(field ...) + #'(field-predicate ...) + #'(field-sanitizer ...)) (define-record-type* #,(id #'stem #'< #'stem #'>) stem #,(id #'stem #'make- #'stem) #,(id #'stem #'stem #'?) - #,@(map (lambda (name getter def) - #`(#,name #,getter (default #,def) + #,@(map (lambda (name getter def sanitizer) + #`(#,name #,getter + (default #,def) (sanitize - #,(id #'stem #'validate- #'stem #'- name)))) + #,(or sanitizer + (id #'stem + #'validate- #'stem #'- name))))) #'(field ...) #'(field-getter ...) - #'(field-default ...)) + #'(field-default ...) + #'(field-sanitizer ...)) (%location #,(id #'stem #'stem #'-source-location) (default (and=> (current-source-location) source-properties->location)) @@ -261,6 +313,9 @@ (define (define-configuration-helper serialize? serializer-prefix syn) (type 'field-type) (getter field-getter) (predicate field-predicate) + (sanitizer + (or field-sanitizer + (id #'stem #'validate- #'stem #'- #'field))) (serializer field-serializer) (default-value-thunk (lambda () diff --git a/tests/services/configuration.scm b/tests/services/configuration.scm index 4f8a74dc8a..c5569a9e50 100644 --- a/tests/services/configuration.scm +++ b/tests/services/configuration.scm @@ -2,6 +2,7 @@ ;;; Copyright © 2021, 2022 Maxim Cournoyer ;;; Copyright © 2021 Xinglu Chen ;;; Copyright © 2022 Ludovic Courtès +;;; Copyright © 2023 Bruno Victal ;;; ;;; This file is part of GNU Guix. ;;; @@ -22,6 +23,7 @@ (define-module (tests services configuration) #:use-module (gnu services configuration) #:use-module (guix diagnostics) #:use-module (guix gexp) + #:autoload (guix i18n) (G_) #:use-module (srfi srfi-34) #:use-module (srfi srfi-64)) @@ -46,14 +48,14 @@ (define-configuration port-configuration (port-configuration-port (port-configuration))) (test-equal "wrong type for a field" - '("configuration.scm" 57 11) ;error location + '("configuration.scm" 59 11) ;error location (guard (c ((configuration-error? c) (let ((loc (error-location c))) (list (basename (location-file loc)) (location-line loc) (location-column loc))))) (port-configuration - ;; This is line 56; the test relies on line/column numbers! + ;; This is line 58; the test relies on line/column numbers! (port "This is not a number!")))) (define-configuration port-configuration-cs @@ -109,6 +111,145 @@ (define-configuration configuration-with-prefix (let ((config (configuration-with-prefix))) (serialize-configuration config configuration-with-prefix-fields)))) + +;;; +;;; define-configuration macro, extra-args literals +;;; + +(define (eval-gexp x) + "Get serialized config as string." + (eval (gexp->approximate-sexp x) + (current-module))) + +(define (port? value) + (or (string? value) (number? value))) + +(define (sanitize-port value) + (cond ((number? value) value) + ((string? value) (string->number value)) + (else (raise (formatted-message (G_ "Bad value: ~a") value))))) + +(let () + ;; Basic sanitizer literal tests + + (define serialize-port serialize-number) + + (define-configuration config-with-sanitizer + (port + (port 80) + "Lorem Ipsum." + (sanitizer sanitize-port))) + + (test-equal "default value, sanitizer" + 80 + (config-with-sanitizer-port (config-with-sanitizer))) + + (test-equal "string value, sanitized to number" + 56 + (config-with-sanitizer-port (config-with-sanitizer + (port "56")))) + + + (define (custom-serialize-port field-name value) + (number->string value)) + + (define-configuration config-serializer + (port + (port 80) + "Lorem Ipsum." + (serializer custom-serialize-port))) + + (test-equal "default value, serializer literal" + "80" + (eval-gexp + (serialize-configuration (config-serializer) + config-serializer-fields)))) + +(let () + ;; empty-serializer as literal/procedure tests + + ;; empty-serializer as literal + (define-configuration config-with-literal + (port + (port 80) + "Lorem Ipsum." + empty-serializer)) + + ;; empty-serializer as procedure + (define-configuration config-with-proc + (port + (port 80) + "Lorem Ipsum." + (serializer empty-serializer))) + + (test-equal "empty-serializer as literal" + "" + (eval-gexp + (serialize-configuration (config-with-literal) + config-with-literal-fields))) + + (test-equal "empty-serializer as procedure" + "" + (eval-gexp + (serialize-configuration (config-with-proc) + config-with-proc-fields)))) + +(let () + ;; permutation tests + + (define-configuration config-san+empty-ser + (port + (port 80) + "Lorem Ipsum." + (sanitizer sanitize-port) + empty-serializer)) + + (define-configuration config-san+ser + (port + (port 80) + "Lorem Ipsum." + (sanitizer sanitize-port) + (serializer (lambda _ "foo")))) + + (test-equal "default value, sanitizer, permutation" + 80 + (config-san+empty-ser-port (config-san+empty-ser))) + + (test-equal "default value, serializer, permutation" + "foo" + (eval-gexp + (serialize-configuration (config-san+ser) config-san+ser-fields))) + + (test-equal "string value, sanitized to number, permutation" + 56 + (config-san+ser-port (config-san+ser + (port "56")))) + + ;; ordering tests + (define-configuration config-ser+san + (port + (port 80) + "Lorem Ipsum." + (sanitizer sanitize-port) + (serializer (lambda _ "foo")))) + + (define-configuration config-empty-ser+san + (port + (port 80) + "Lorem Ipsum." + empty-serializer + (sanitizer sanitize-port))) + + (test-equal "default value, sanitizer, permutation 2" + 56 + (config-empty-ser+san-port (config-empty-ser+san + (port "56")))) + + (test-equal "default value, serializer, permutation 2" + "foo" + (eval-gexp + (serialize-configuration (config-ser+san) config-ser+san-fields)))) + ;;; ;;; define-maybe macro. -- 2.39.1 From unknown Fri Jun 20 07:19:24 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#62298] [PATCH 6/8] services: mpd: Set PulseAudio related variables as default value for environment-variables field. Resent-From: Bruno Victal Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 20 Mar 2023 17:08:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 62298 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 62298@debbugs.gnu.org Cc: ludo@gnu.org, Bruno Victal , liliana.prikler@gmail.com, maxim.cournoyer@gmail.com Received: via spool by 62298-submit@debbugs.gnu.org id=B62298.167933204311476 (code B ref 62298); Mon, 20 Mar 2023 17:08:02 +0000 Received: (at 62298) by debbugs.gnu.org; 20 Mar 2023 17:07:23 +0000 Received: from localhost ([127.0.0.1]:55635 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1peIyh-0002yz-68 for submit@debbugs.gnu.org; Mon, 20 Mar 2023 13:07:23 -0400 Received: from smtpmciv1.myservices.hosting ([185.26.107.237]:43354) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1peIyd-0002yM-JX for 62298@debbugs.gnu.org; Mon, 20 Mar 2023 13:07:20 -0400 Received: from mail1.netim.hosting (unknown [185.26.106.173]) by smtpmciv1.myservices.hosting (Postfix) with ESMTP id 8DFF22077A; Mon, 20 Mar 2023 18:07:18 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by mail1.netim.hosting (Postfix) with ESMTP id 53F84800A7; Mon, 20 Mar 2023 18:07:18 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at mail1.netim.hosting Received: from mail1.netim.hosting ([127.0.0.1]) by localhost (mail1-2.netim.hosting [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id M94tllYFw8Mc; Mon, 20 Mar 2023 18:07:18 +0100 (CET) Received: from guix-nuc.home.arpa (bl9-119-177.dsl.telepac.pt [85.242.119.177]) (Authenticated sender: lumen@makinata.eu) by mail1.netim.hosting (Postfix) with ESMTPSA id B18EC800A4; Mon, 20 Mar 2023 18:07:17 +0100 (CET) From: Bruno Victal Date: Mon, 20 Mar 2023 17:07:11 +0000 Message-Id: <46ed2d0269e7813f51f043d2600141216c36bc30.1679332019.git.mirai@makinata.eu> X-Mailer: git-send-email 2.39.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 (-) These variables are necessary for PulseAudio to work properly out-of-the-box for 'non-interactive' users. * doc/guix.texi (Audio Services): Update environment-variables field description for mpd-configuration data type. * gnu/services/audio.scm (mpd-configuration)[environment-variables]: Set PULSE_CLIENTCONFIG and PULSE_CONFIG environment variables to the system-wide PulseAudio configuration. --- doc/guix.texi | 2 +- gnu/services/audio.scm | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index 7927e3166b..df424c561f 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -33474,7 +33474,7 @@ Audio Services This is a list of symbols naming Shepherd services that this service will depend on. -@item @code{environment-variables} (default: @code{()}) (type: list-of-strings) +@item @code{environment-variables} (default: @code{("PULSE_CLIENTCONFIG=/etc/pulse/client.conf" "PULSE_CONFIG=/etc/pulse/daemon.conf")}) (type: list-of-strings) A list of strings specifying environment variables. @item @code{log-file} (default: @code{"/var/log/mpd/log"}) (type: maybe-string) diff --git a/gnu/services/audio.scm b/gnu/services/audio.scm index ec6b3c5466..0682367358 100644 --- a/gnu/services/audio.scm +++ b/gnu/services/audio.scm @@ -361,7 +361,8 @@ (define-configuration mpd-configuration empty-serializer) (environment-variables - (list-of-strings '()) + (list-of-strings '("PULSE_CLIENTCONFIG=/etc/pulse/client.conf" + "PULSE_CONFIG=/etc/pulse/daemon.conf")) "A list of strings specifying environment variables." empty-serializer) -- 2.39.1 From unknown Fri Jun 20 07:19:24 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#62298] [PATCH 5/8] services: mpd: Fix unintentional API breakage for mixer-type field. Resent-From: Bruno Victal Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 20 Mar 2023 17:08:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 62298 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 62298@debbugs.gnu.org Cc: ludo@gnu.org, Bruno Victal , liliana.prikler@gmail.com, maxim.cournoyer@gmail.com Received: via spool by 62298-submit@debbugs.gnu.org id=B62298.167933204411484 (code B ref 62298); Mon, 20 Mar 2023 17:08:02 +0000 Received: (at 62298) by debbugs.gnu.org; 20 Mar 2023 17:07:24 +0000 Received: from localhost ([127.0.0.1]:55637 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1peIyh-0002z3-Fj for submit@debbugs.gnu.org; Mon, 20 Mar 2023 13:07:23 -0400 Received: from smtpm3.myservices.hosting ([185.26.105.234]:40258) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1peIyd-0002yL-LD for 62298@debbugs.gnu.org; Mon, 20 Mar 2023 13:07:20 -0400 Received: from mail1.netim.hosting (unknown [185.26.106.173]) by smtpm3.myservices.hosting (Postfix) with ESMTP id 1942E20FAB; Mon, 20 Mar 2023 18:07:17 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by mail1.netim.hosting (Postfix) with ESMTP id C0937800A5; Mon, 20 Mar 2023 18:07:17 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at mail1.netim.hosting Received: from mail1.netim.hosting ([127.0.0.1]) by localhost (mail1-2.netim.hosting [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id t94z_oZknZ6n; Mon, 20 Mar 2023 18:07:17 +0100 (CET) Received: from guix-nuc.home.arpa (bl9-119-177.dsl.telepac.pt [85.242.119.177]) (Authenticated sender: lumen@makinata.eu) by mail1.netim.hosting (Postfix) with ESMTPSA id 3690B8009D; Mon, 20 Mar 2023 18:07:17 +0100 (CET) From: Bruno Victal Date: Mon, 20 Mar 2023 17:07:10 +0000 Message-Id: <2e1f2722a4dd77e590bdda0b6b394675c9835f7c.1679332019.git.mirai@makinata.eu> X-Mailer: git-send-email 2.39.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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/audio.scm (mpd-output)[mixer-type]: Use sanitizer to accept both strings and symbols as values. --- gnu/services/audio.scm | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/gnu/services/audio.scm b/gnu/services/audio.scm index e5b065a479..ec6b3c5466 100644 --- a/gnu/services/audio.scm +++ b/gnu/services/audio.scm @@ -140,6 +140,11 @@ (define (uglify-field-name field-name) (define list-of-symbol? (list-of symbol?)) + +;;; +;;; MPD +;;; + (define (mpd-serialize-field field-name value) (let ((field (if (string? field-name) field-name (uglify-field-name field-name))) @@ -294,7 +299,17 @@ (define-configuration mpd-output for this audio output: the @code{hardware} mixer, the @code{software} mixer, the @code{null} mixer (allows setting the volume, but with no effect; this can be used as a trick to implement an external mixer -External Mixer) or no mixer (@code{none}).") +External Mixer) or no mixer (@code{none})." + (sanitizer + (lambda (x) ; TODO: deprecated, remove me later. + (cond + ((symbol? x) + (warning (G_ "symbol value for 'mixer-type' is deprecated, \ +use string instead~%")) + (symbol->string x)) + ((string? x) x) + (else + (leave (G_ "invalid input for 'mixer-type'~%"))))))) (replay-gain-handler maybe-string -- 2.39.1 From unknown Fri Jun 20 07:19:24 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#62298] [PATCH 3/8] services: audio: remove redundant list-of-string? predicate. Resent-From: Bruno Victal Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 20 Mar 2023 17:08:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 62298 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 62298@debbugs.gnu.org Cc: ludo@gnu.org, Bruno Victal , liliana.prikler@gmail.com, maxim.cournoyer@gmail.com Received: via spool by 62298-submit@debbugs.gnu.org id=B62298.167933204511493 (code B ref 62298); Mon, 20 Mar 2023 17:08:03 +0000 Received: (at 62298) by debbugs.gnu.org; 20 Mar 2023 17:07:25 +0000 Received: from localhost ([127.0.0.1]:55640 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1peIyh-0002zB-Tn for submit@debbugs.gnu.org; Mon, 20 Mar 2023 13:07:24 -0400 Received: from smtpmciv4.myservices.hosting ([185.26.107.240]:34784) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1peIyf-0002yS-3O for 62298@debbugs.gnu.org; Mon, 20 Mar 2023 13:07:22 -0400 Received: from mail1.netim.hosting (unknown [185.26.106.173]) by smtpmciv4.myservices.hosting (Postfix) with ESMTP id E31BA207FB; Mon, 20 Mar 2023 18:07:18 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by mail1.netim.hosting (Postfix) with ESMTP id 93BF1800A4; Mon, 20 Mar 2023 18:07:18 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at mail1.netim.hosting Received: from mail1.netim.hosting ([127.0.0.1]) by localhost (mail1-2.netim.hosting [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id 3Dq275zW8KaM; Mon, 20 Mar 2023 18:07:16 +0100 (CET) Received: from guix-nuc.home.arpa (bl9-119-177.dsl.telepac.pt [85.242.119.177]) (Authenticated sender: lumen@makinata.eu) by mail1.netim.hosting (Postfix) with ESMTPSA id 32E0F8009B; Mon, 20 Mar 2023 18:07:16 +0100 (CET) From: Bruno Victal Date: Mon, 20 Mar 2023 17:07:08 +0000 Message-Id: <2e95d328faa56f53a5a69826ecf37bd34ccd22b6.1679332019.git.mirai@makinata.eu> X-Mailer: git-send-email 2.39.1 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 (-) Use list-of-strings? predicate defined in (gnu services configuration). * gnu/services/audio.scm (list-of-string?): Remove predicate. (mpd-serialize-list-of-string): Rename procedure to ... (mpd-serialize-list-of-strings): ... this. (mpd-configuration)[environment-variables]: Switch to list-of-strings. [endpoints]: Switch to maybe-list-of-strings. (mympd-ip-acl)[allow, deny]: Switch to list-of-strings. (mympd-serialize-configuration): Rename serialize-list-of-string to serialize-list-of-strings. * doc/guix.texi (Audio Services): Update it. --- doc/guix.texi | 8 ++++---- gnu/services/audio.scm | 25 +++++++++++-------------- 2 files changed, 15 insertions(+), 18 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index f84cadeeda..7927e3166b 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -33474,7 +33474,7 @@ Audio Services This is a list of symbols naming Shepherd services that this service will depend on. -@item @code{environment-variables} (default: @code{()}) (type: list-of-string) +@item @code{environment-variables} (default: @code{()}) (type: list-of-strings) A list of strings specifying environment variables. @item @code{log-file} (default: @code{"/var/log/mpd/log"}) (type: maybe-string) @@ -33505,7 +33505,7 @@ Audio Services @item @code{default-port} (default: @code{6600}) (type: maybe-integer) The default port to run mpd on. -@item @code{endpoints} (type: maybe-list-of-string) +@item @code{endpoints} (type: maybe-list-of-strings) The addresses that mpd will bind to. A port different from @var{default-port} may be specified, e.g. @code{localhost:6602} and IPv6 addresses must be enclosed in square brackets when a different port is used. @@ -33781,10 +33781,10 @@ Audio Services Available @code{mympd-ip-acl} fields are: @table @asis -@item @code{allow} (default: @code{()}) (type: list-of-string) +@item @code{allow} (default: @code{()}) (type: list-of-strings) Allowed IP addresses. -@item @code{deny} (default: @code{()}) (type: list-of-string) +@item @code{deny} (default: @code{()}) (type: list-of-strings) Disallowed IP addresses. @end table diff --git a/gnu/services/audio.scm b/gnu/services/audio.scm index 5f341fac0f..e9ecccd614 100644 --- a/gnu/services/audio.scm +++ b/gnu/services/audio.scm @@ -2,7 +2,7 @@ ;;; Copyright © 2017 Peter Mikkelsen ;;; Copyright © 2019 Ricardo Wurmus ;;; Copyright © 2020 Ludovic Courtès -;;; Copyright © 2022 Bruno Victal +;;; Copyright © 2022⁠–⁠2023 Bruno Victal ;;; ;;; This file is part of GNU Guix. ;;; @@ -137,9 +137,6 @@ (define (uglify-field-name field-name) str) #\-) "_"))) -(define list-of-string? - (list-of string?)) - (define list-of-symbol? (list-of symbol?)) @@ -159,11 +156,11 @@ (define (mpd-serialize-alist field-name value) (define mpd-serialize-string mpd-serialize-field) (define mpd-serialize-boolean mpd-serialize-field) -(define (mpd-serialize-list-of-string field-name value) +(define (mpd-serialize-list-of-strings field-name value) #~(string-append #$@(map (cut mpd-serialize-string field-name <>) value))) (define-maybe string (prefix mpd-)) -(define-maybe list-of-string (prefix mpd-)) +(define-maybe list-of-strings (prefix mpd-)) (define-maybe boolean (prefix mpd-)) ;;; TODO: Procedures for deprecated fields, to be removed. @@ -349,7 +346,7 @@ (define-configuration mpd-configuration empty-serializer) (environment-variables - (list-of-string '()) + (list-of-strings '()) "A list of strings specifying environment variables." empty-serializer) @@ -400,7 +397,7 @@ (define-configuration mpd-configuration "The default port to run mpd on.") (endpoints - maybe-list-of-string + maybe-list-of-strings "The addresses that mpd will bind to. A port different from @var{default-port} may be specified, e.g. @code{localhost:6602} and IPv6 addresses must be enclosed in square brackets when a different @@ -409,7 +406,7 @@ (define-configuration mpd-configuration can be specified here." (serializer (lambda (_ endpoints) (if (maybe-value-set? endpoints) - (mpd-serialize-list-of-string "bind_to_address" endpoints) + (mpd-serialize-list-of-strings "bind_to_address" endpoints) "")))) (address ; TODO: deprecated, remove later @@ -581,11 +578,11 @@ (define (string-or-symbol? x) (define-configuration/no-serialization mympd-ip-acl (allow - (list-of-string '()) + (list-of-strings '()) "Allowed IP addresses.") (deny - (list-of-string '()) + (list-of-strings '()) "Disallowed IP addresses.")) (define-maybe/no-serialization integer) @@ -707,12 +704,12 @@ (define (mympd-serialize-configuration config) ((? string? val) val))) (define (ip-acl-serialize-configuration config) - (define (serialize-list-of-string prefix lst) + (define (serialize-list-of-strings prefix lst) (map (cut format #f "~a~a" prefix <>) lst)) (string-join (append - (serialize-list-of-string "+" (mympd-ip-acl-allow config)) - (serialize-list-of-string "-" (mympd-ip-acl-deny config))) ",")) + (serialize-list-of-strings "+" (mympd-ip-acl-allow config)) + (serialize-list-of-strings "-" (mympd-ip-acl-deny config))) ",")) ;; myMPD configuration fields are serialized as individual files under ;; /config/. -- 2.39.1 From unknown Fri Jun 20 07:19:24 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#62298] [PATCH 2/8] services: replace bare serializers with (serializer ...) Resent-From: Bruno Victal Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 20 Mar 2023 17:08:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 62298 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 62298@debbugs.gnu.org Cc: ludo@gnu.org, Bruno Victal , liliana.prikler@gmail.com, maxim.cournoyer@gmail.com Received: via spool by 62298-submit@debbugs.gnu.org id=B62298.167933204511506 (code B ref 62298); Mon, 20 Mar 2023 17:08:03 +0000 Received: (at 62298) by debbugs.gnu.org; 20 Mar 2023 17:07:25 +0000 Received: from localhost ([127.0.0.1]:55643 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1peIyi-0002zK-Ux for submit@debbugs.gnu.org; Mon, 20 Mar 2023 13:07:25 -0400 Received: from smtpm2.myservices.hosting ([185.26.105.233]:57138) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1peIyf-0002yg-Fo for 62298@debbugs.gnu.org; Mon, 20 Mar 2023 13:07:22 -0400 Received: from mail1.netim.hosting (unknown [185.26.106.173]) by smtpm2.myservices.hosting (Postfix) with ESMTP id 218EE20D8D; Mon, 20 Mar 2023 18:07:19 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by mail1.netim.hosting (Postfix) with ESMTP id AD324800A3; Mon, 20 Mar 2023 18:07:16 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at mail1.netim.hosting Received: from mail1.netim.hosting ([127.0.0.1]) by localhost (mail1-2.netim.hosting [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id DSsCrpj77SEz; Mon, 20 Mar 2023 18:07:16 +0100 (CET) Received: from guix-nuc.home.arpa (bl9-119-177.dsl.telepac.pt [85.242.119.177]) (Authenticated sender: lumen@makinata.eu) by mail1.netim.hosting (Postfix) with ESMTPSA id A87698009D; Mon, 20 Mar 2023 18:07:15 +0100 (CET) From: Bruno Victal Date: Mon, 20 Mar 2023 17:07:07 +0000 Message-Id: <1eed557ccb219d63cac51db502e20bdec9662741.1679332019.git.mirai@makinata.eu> X-Mailer: git-send-email 2.39.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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/home/services/shells.scm (home-zsh-configuration)[environment-variables]: Use (serializer ...). (home-bash-configuration)[aliases, environment-variables]: Ditto. (home-fish-configuration)[abbreviations, aliases, environment-variables]: Ditto. * gnu/services/audio.scm (mpd-configuration)[music-dir, playlist-dir, endpoints] [address, inputs, archive-plugins, input-cache-size, decoders, filters, playlist-plugins]: Ditto. * gnu/services/security.scm (fail2ban-jail-configuration)[backend, log-encoding, extra-content]: Ditto. * tests/services/configuration.scm: Update tests. Add test for deprecated bare serializers. --- gnu/home/services/shells.scm | 12 ++++----- gnu/services/audio.scm | 44 ++++++++++++++++---------------- gnu/services/security.scm | 6 ++--- tests/services/configuration.scm | 11 +++++++- 4 files changed, 41 insertions(+), 32 deletions(-) diff --git a/gnu/home/services/shells.scm b/gnu/home/services/shells.scm index 3326eb37f4..f05f2221d6 100644 --- a/gnu/home/services/shells.scm +++ b/gnu/home/services/shells.scm @@ -133,7 +133,7 @@ (define-configuration home-zsh-configuration (environment-variables (alist '()) "Association list of environment variables to set for the Zsh session." - serialize-posix-env-vars) + (serializer serialize-posix-env-vars)) (zshenv (text-config '()) "List of file-like objects, which will be added to @file{.zshenv}. @@ -334,7 +334,7 @@ (define-configuration home-bash-configuration rules for the @code{home-environment-variables-service-type} apply here (@pxref{Essential Home Services}). The contents of this field will be added after the contents of the @code{bash-profile} field." - serialize-posix-env-vars) + (serializer serialize-posix-env-vars)) (aliases (alist '()) "Association list of aliases to set for the Bash session. The aliases will be @@ -351,7 +351,7 @@ (define-configuration home-bash-configuration @example alias ls=\"ls -alF\" @end example" - bash-serialize-aliases) + (serializer bash-serialize-aliases)) (bash-profile (text-config '()) "List of file-like objects, which will be added to @file{.bash_profile}. @@ -536,19 +536,19 @@ (define-configuration home-fish-configuration (environment-variables (alist '()) "Association list of environment variables to set in Fish." - serialize-fish-env-vars) + (serializer serialize-fish-env-vars)) (aliases (alist '()) "Association list of aliases for Fish, both the key and the value should be a string. An alias is just a simple function that wraps a command, If you want something more akin to @dfn{aliases} in POSIX shells, see the @code{abbreviations} field." - serialize-fish-aliases) + (serializer serialize-fish-aliases)) (abbreviations (alist '()) "Association list of abbreviations for Fish. These are words that, when typed in the shell, will automatically expand to the full text." - serialize-fish-abbreviations)) + (serializer serialize-fish-abbreviations))) (define (fish-files-service config) `(("fish/config.fish" diff --git a/gnu/services/audio.scm b/gnu/services/audio.scm index d55b804ba9..5f341fac0f 100644 --- a/gnu/services/audio.scm +++ b/gnu/services/audio.scm @@ -372,7 +372,7 @@ (define-configuration mpd-configuration (music-dir ; TODO: deprecated, remove later maybe-string "The directory to scan for music files." - mpd-serialize-deprecated-field) + (serializer mpd-serialize-deprecated-field)) (playlist-directory maybe-string @@ -381,7 +381,7 @@ (define-configuration mpd-configuration (playlist-dir ; TODO: deprecated, remove later maybe-string "The directory to store playlists." - mpd-serialize-deprecated-field) + (serializer mpd-serialize-deprecated-field)) (db-file maybe-string @@ -407,16 +407,16 @@ (define-configuration mpd-configuration port is used. To use a Unix domain socket, an absolute path or a path starting with @code{~} can be specified here." - (lambda (_ endpoints) - (if (maybe-value-set? endpoints) - (mpd-serialize-list-of-string "bind_to_address" endpoints) - ""))) + (serializer (lambda (_ endpoints) + (if (maybe-value-set? endpoints) + (mpd-serialize-list-of-string "bind_to_address" endpoints) + "")))) (address ; TODO: deprecated, remove later maybe-string "The address that mpd will bind to. To use a Unix domain socket, an absolute path can be specified here." - mpd-serialize-deprecated-field) + (serializer mpd-serialize-deprecated-field)) (database maybe-mpd-plugin @@ -433,29 +433,29 @@ (define-configuration mpd-configuration (inputs (list-of-mpd-plugin '()) "List of MPD input plugin configurations." - (lambda (_ x) - (mpd-serialize-list-of-mpd-plugin "input" x))) + (serializer (lambda (_ x) + (mpd-serialize-list-of-mpd-plugin "input" x)))) (archive-plugins (list-of-mpd-plugin '()) "List of MPD archive plugin configurations." - (lambda (_ x) - (mpd-serialize-list-of-mpd-plugin "archive_plugin" x))) + (serializer (lambda (_ x) + (mpd-serialize-list-of-mpd-plugin "archive_plugin" x)))) (input-cache-size maybe-string "MPD input cache size." - (lambda (_ x) - (if (maybe-value-set? x) - #~(string-append "\ninput_cache {\n" - #$(mpd-serialize-string "size" x) - "}\n") ""))) + (serializer (lambda (_ x) + (if (maybe-value-set? x) + #~(string-append "\ninput_cache {\n" + #$(mpd-serialize-string "size" x) + "}\n") "")))) (decoders (list-of-mpd-plugin '()) "List of MPD decoder plugin configurations." - (lambda (_ x) - (mpd-serialize-list-of-mpd-plugin "decoder" x))) + (serializer (lambda (_ x) + (mpd-serialize-list-of-mpd-plugin "decoder" x)))) (resampler maybe-mpd-plugin @@ -464,8 +464,8 @@ (define-configuration mpd-configuration (filters (list-of-mpd-plugin '()) "List of MPD filter plugin configurations." - (lambda (_ x) - (mpd-serialize-list-of-mpd-plugin "filter" x))) + (serializer (lambda (_ x) + (mpd-serialize-list-of-mpd-plugin "filter" x)))) (outputs (list-of-mpd-plugin-or-output (list (mpd-output))) @@ -475,8 +475,8 @@ (define-configuration mpd-configuration (playlist-plugins (list-of-mpd-plugin '()) "List of MPD playlist plugin configurations." - (lambda (_ x) - (mpd-serialize-list-of-mpd-plugin "playlist_plugin" x))) + (serializer (lambda (_ x) + (mpd-serialize-list-of-mpd-plugin "playlist_plugin" x)))) (extra-options (alist '()) diff --git a/gnu/services/security.scm b/gnu/services/security.scm index 8116072920..e750bb468b 100644 --- a/gnu/services/security.scm +++ b/gnu/services/security.scm @@ -200,7 +200,7 @@ (define-configuration fail2ban-jail-configuration "Backend to use to detect changes in the @code{log-path}. The default is 'auto. To consult the defaults of the jail configuration, refer to the @file{/etc/fail2ban/jail.conf} file of the @code{fail2ban} package." - fail2ban-jail-configuration-serialize-backend) + (serializer fail2ban-jail-configuration-serialize-backend)) (max-retry maybe-integer "The number of failures before a host get banned @@ -269,7 +269,7 @@ (define-configuration fail2ban-jail-configuration maybe-symbol "The encoding of the log files handled by the jail. Possible values are: @code{'ascii}, @code{'utf-8} and @code{'auto}." - fail2ban-jail-configuration-serialize-log-encoding) + (serializer fail2ban-jail-configuration-serialize-log-encoding)) (log-path (list-of-strings '()) "The file names of the log files to be monitored.") @@ -280,7 +280,7 @@ (define-configuration fail2ban-jail-configuration (text-config '()) "Extra content for the jail configuration, provided as a list of file-like objects." - serialize-text-config) + (serializer serialize-text-config)) (prefix fail2ban-jail-configuration-)) (define list-of-fail2ban-jail-configurations? diff --git a/tests/services/configuration.scm b/tests/services/configuration.scm index c5569a9e50..6abab2832f 100644 --- a/tests/services/configuration.scm +++ b/tests/services/configuration.scm @@ -82,6 +82,9 @@ (define (custom-number-serializer name value) (format #f "~a = ~a;" name value)) (define-configuration serializable-configuration + (port (number 80) "The port number." (serializer custom-number-serializer))) + +(define-configuration serializable-configuration-deprecated (port (number 80) "The port number." custom-number-serializer)) (test-assert "serialize-configuration" @@ -89,8 +92,14 @@ (define-configuration serializable-configuration (let ((config (serializable-configuration))) (serialize-configuration config serializable-configuration-fields)))) +(test-assert "serialize-configuration [deprecated]" + (gexp? + (let ((config (serializable-configuration-deprecated))) + (serialize-configuration + config serializable-configuration-deprecated-fields)))) + (define-configuration serializable-configuration - (port (number 80) "The port number." custom-number-serializer) + (port (number 80) "The port number." (serializer custom-number-serializer)) (no-serialization)) (test-assert "serialize-configuration with no-serialization" -- 2.39.1 From unknown Fri Jun 20 07:19:24 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#62298] [PATCH 7/8] services: mpd: Use user-account (resp. user-group) for user (resp. group) fields. Resent-From: Bruno Victal Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 20 Mar 2023 17:08:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 62298 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 62298@debbugs.gnu.org Cc: ludo@gnu.org, Bruno Victal , liliana.prikler@gmail.com, maxim.cournoyer@gmail.com Received: via spool by 62298-submit@debbugs.gnu.org id=B62298.167933205511528 (code B ref 62298); Mon, 20 Mar 2023 17:08:03 +0000 Received: (at 62298) by debbugs.gnu.org; 20 Mar 2023 17:07:35 +0000 Received: from localhost ([127.0.0.1]:55645 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1peIys-0002zr-PO for submit@debbugs.gnu.org; Mon, 20 Mar 2023 13:07:35 -0400 Received: from smtpm3.myservices.hosting ([185.26.105.234]:40280) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1peIyi-0002z9-0n for 62298@debbugs.gnu.org; Mon, 20 Mar 2023 13:07:24 -0400 Received: from mail1.netim.hosting (unknown [185.26.106.173]) by smtpm3.myservices.hosting (Postfix) with ESMTP id 4CDC520FB1; Mon, 20 Mar 2023 18:07:19 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by mail1.netim.hosting (Postfix) with ESMTP id E9706800A5; Mon, 20 Mar 2023 18:07:18 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at mail1.netim.hosting Received: from mail1.netim.hosting ([127.0.0.1]) by localhost (mail1-2.netim.hosting [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id P8nfqzf0hzWY; Mon, 20 Mar 2023 18:07:18 +0100 (CET) Received: from guix-nuc.home.arpa (bl9-119-177.dsl.telepac.pt [85.242.119.177]) (Authenticated sender: lumen@makinata.eu) by mail1.netim.hosting (Postfix) with ESMTPSA id 396FE8009D; Mon, 20 Mar 2023 18:07:18 +0100 (CET) From: Bruno Victal Date: Mon, 20 Mar 2023 17:07:12 +0000 Message-Id: <6e1da37de3839d56546389924ce47b4563d05d94.1679332019.git.mirai@makinata.eu> X-Mailer: git-send-email 2.39.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 (-) Deprecate using strings for these fields and prefer user-account (resp. user-group) instead to avoid duplication within account-service-type. If a string value is encountered, it is ignored and a predefined variable is used instead. This is essentially a rollback to how it used to be before '5c5f0fc1135ff15f9c4adfc5f27eadd9a592b5d1'. Fixes #61570 . * gnu/services/audio.scm (mpd-serialize-user-account, mpd-serialize-user-group) (mpd-user-sanitizer, mpd-group-sanitizer): New procedure. (%mpd-user, %mpd-group): New variable. (mpd-configuration)[user, group]: Set value type to user-account (resp. user-group). (mpd-shepherd-service): Adapt for user-account values in user field. (mpd-accounts): Adapt for user-account (resp. user-group) in user (resp. group) field. * doc/guix.texi (Audio Services): Update documentation. --- doc/guix.texi | 4 +-- gnu/services/audio.scm | 70 ++++++++++++++++++++++++++++++++---------- 2 files changed, 55 insertions(+), 19 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index df424c561f..ecc520397c 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -33464,10 +33464,10 @@ Audio Services @item @code{package} (default: @code{mpd}) (type: file-like) The MPD package. -@item @code{user} (default: @code{"mpd"}) (type: string) +@item @code{user} (type: maybe-user-account) The user to run mpd as. -@item @code{group} (default: @code{"mpd"}) (type: string) +@item @code{group} (type: maybe-user-group) The group to run mpd as. @item @code{shepherd-requirement} (default: @code{()}) (type: list-of-symbol) diff --git a/gnu/services/audio.scm b/gnu/services/audio.scm index 0682367358..eaee9b1536 100644 --- a/gnu/services/audio.scm +++ b/gnu/services/audio.scm @@ -164,9 +164,32 @@ (define mpd-serialize-boolean mpd-serialize-field) (define (mpd-serialize-list-of-strings field-name value) #~(string-append #$@(map (cut mpd-serialize-string field-name <>) value))) +(define (mpd-serialize-user-account field-name value) + (mpd-serialize-string field-name (user-account-name value))) + +(define (mpd-serialize-user-group field-name value) + (mpd-serialize-string field-name (user-group-name value))) + (define-maybe string (prefix mpd-)) (define-maybe list-of-strings (prefix mpd-)) (define-maybe boolean (prefix mpd-)) +(define-maybe user-account (prefix mpd-)) +(define-maybe user-group (prefix mpd-)) + +(define %mpd-user + (user-account + (name "mpd") + (group "mpd") + (system? #t) + (comment "Music Player Daemon (MPD) user") + ;; MPD can use $HOME (or $XDG_CONFIG_HOME) to place its data + (home-directory "/var/lib/mpd") + (shell (file-append shadow "/sbin/nologin")))) + +(define %mpd-group + (user-group + (name "mpd") + (system? #t))) ;;; TODO: Procedures for deprecated fields, to be removed. @@ -197,6 +220,26 @@ (define (mpd-serialize-port field-name value) (define-maybe port (prefix mpd-)) +;;; procedures for unsupported value types, to be removed. + +(define (mpd-user-sanitizer value) + (cond ((user-account? value) value) + ((string? value) + (warning (G_ "string value for 'user' is not supported, use \ +user-account instead. Ignoring this value~%")) + %mpd-user) + (else + (leave (G_ "'~a' is not a valid value for 'user'~%") value)))) + +(define (mpd-group-sanitizer value) + (cond ((user-group? value) value) + ((string? value) + (warning (G_ "string value for 'group' is not supported, use \ +user-group instead. Ignoring this value~%")) + %mpd-group) + (else + (leave (G_ "'~a' is not a valid value for 'group'~%") value)))) + ;;; ;; Generic MPD plugin record, lists only the most prevalent fields. @@ -347,12 +390,14 @@ (define-configuration mpd-configuration empty-serializer) (user - (string "mpd") - "The user to run mpd as.") + (maybe-user-account %mpd-user) + "The user to run mpd as." + (sanitizer mpd-user-sanitizer)) (group - (string "mpd") - "The group to run mpd as.") + (maybe-user-group %mpd-group) + "The group to run mpd as." + (sanitizer mpd-group-sanitizer)) (shepherd-requirement (list-of-symbol '()) @@ -516,7 +561,8 @@ (define (mpd-shepherd-service config) log-file playlist-directory db-file state-file sticker-file environment-variables) - (let* ((config-file (mpd-serialize-configuration config))) + (let ((config-file (mpd-serialize-configuration config)) + (username (user-account-name user))) (shepherd-service (documentation "Run the MPD (Music Player Daemon)") (requirement `(user-processes loopback ,@shepherd-requirement)) @@ -525,7 +571,7 @@ (define (mpd-shepherd-service config) (and=> #$(maybe-value log-file) (compose mkdir-p dirname)) - (let ((user (getpw #$user))) + (let ((user (getpw #$username))) (for-each (lambda (x) (when (and x (not (file-exists? x))) @@ -559,17 +605,7 @@ (define (mpd-shepherd-service config) (define (mpd-accounts config) (match-record config (user group) - (list (user-group - (name group) - (system? #t)) - (user-account - (name user) - (group group) - (system? #t) - (comment "Music Player Daemon (MPD) user") - ;; MPD can use $HOME (or $XDG_CONFIG_HOME) to place its data - (home-directory "/var/lib/mpd") - (shell (file-append shadow "/sbin/nologin")))))) + (list user group))) (define mpd-service-type (service-type -- 2.39.1 From unknown Fri Jun 20 07:19:24 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#62298] [PATCH 8/8] services: mympd: Use user-account (resp. user-group) for user (resp. group) fields. Resent-From: Bruno Victal Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 20 Mar 2023 17:08:04 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 62298 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 62298@debbugs.gnu.org Cc: ludo@gnu.org, Bruno Victal , liliana.prikler@gmail.com, maxim.cournoyer@gmail.com Received: via spool by 62298-submit@debbugs.gnu.org id=B62298.167933205511535 (code B ref 62298); Mon, 20 Mar 2023 17:08:04 +0000 Received: (at 62298) by debbugs.gnu.org; 20 Mar 2023 17:07:35 +0000 Received: from localhost ([127.0.0.1]:55647 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1peIyt-0002zt-9J for submit@debbugs.gnu.org; Mon, 20 Mar 2023 13:07:35 -0400 Received: from smtpmciv1.myservices.hosting ([185.26.107.237]:43378) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1peIyh-0002z1-MU for 62298@debbugs.gnu.org; Mon, 20 Mar 2023 13:07:28 -0400 Received: from mail1.netim.hosting (unknown [185.26.106.173]) by smtpmciv1.myservices.hosting (Postfix) with ESMTP id DDE30209F4; Mon, 20 Mar 2023 18:07:19 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by mail1.netim.hosting (Postfix) with ESMTP id AD18A8009D; Mon, 20 Mar 2023 18:07:19 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at mail1.netim.hosting Received: from mail1.netim.hosting ([127.0.0.1]) by localhost (mail1-2.netim.hosting [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id oIeK0MeG4TvO; Mon, 20 Mar 2023 18:07:19 +0100 (CET) Received: from guix-nuc.home.arpa (bl9-119-177.dsl.telepac.pt [85.242.119.177]) (Authenticated sender: lumen@makinata.eu) by mail1.netim.hosting (Postfix) with ESMTPSA id BE6C58009B; Mon, 20 Mar 2023 18:07:18 +0100 (CET) From: Bruno Victal Date: Mon, 20 Mar 2023 17:07:13 +0000 Message-Id: <48b9090890e5a03710bccaa9b48967c3db5560fd.1679332019.git.mirai@makinata.eu> X-Mailer: git-send-email 2.39.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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/audio.scm (%mympd-user, %mympd-group): New variable. (mympd-user-sanitizer, mympd-group-sanitizer): New procedure. (mympd-configuration)[user, group]: Set value type to user-account (resp. user-group). (mympd-serialize-configuration): Adapt for user-account values in user field. (mympd-accounts): Adapt for user-account (resp. user-group) in user (resp. group) field. --- doc/guix.texi | 4 +-- gnu/services/audio.scm | 63 +++++++++++++++++++++++++++++++++--------- 2 files changed, 52 insertions(+), 15 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index ecc520397c..7c7e45ec8e 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -33705,10 +33705,10 @@ Audio Services This is a list of symbols naming Shepherd services that this service will depend on. -@item @code{user} (default: @code{"mympd"}) (type: string) +@item @code{user} (type: maybe-user-account) Owner of the @command{mympd} process. -@item @code{group} (default: @code{"nogroup"}) (type: string) +@item @code{group} (type: maybe-user-group) Owner group of the @command{mympd} process. @item @code{work-directory} (default: @code{"/var/lib/mympd"}) (type: string) diff --git a/gnu/services/audio.scm b/gnu/services/audio.scm index eaee9b1536..9211cbcc52 100644 --- a/gnu/services/audio.scm +++ b/gnu/services/audio.scm @@ -640,6 +640,47 @@ (define-configuration/no-serialization mympd-ip-acl (define-maybe/no-serialization integer) (define-maybe/no-serialization mympd-ip-acl) +;; XXX: These will shadow the previous definition used by mpd +;; and cause warnings to be shown. Maybe split the file +;; into audio/mpd.scm and audio/mympd.scm ? +#;(define-maybe/no-serialization user-account) +#;(define-maybe/no-serialization user-group) + +(define %mympd-user + (user-account + (name "mympd") + (group "mympd") + (system? #t) + (comment "myMPD user") + (home-directory "/var/empty") + (shell (file-append shadow "/sbin/nologin")))) + +(define %mympd-group + (user-group + (name "mympd") + (system? #t))) + +;;; TODO: procedures for unsupported value types, to be removed. +(define (mympd-user-sanitizer value) + (cond ((user-account? value) value) + ((string? value) + (warning (G_ "string value for 'user' is not supported, use \ +user-account instead. Ignoring this value~%")) + %mympd-user) + (else + (leave (G_ "'~a' is not a valid value for 'user'~%") value)))) + +(define (mympd-group-sanitizer value) + (cond ((user-group? value) value) + ((string? value) + (warning (G_ "string value for 'group' is not supported, use \ +user-group instead. Ignoring this value~%")) + %mympd-group) + (else + (leave (G_ "'~a' is not a valid value for 'group'~%") value)))) +;;; + + ;; XXX: The serialization procedures are insufficient since we require ;; access to multiple fields at once. ;; Fields marked with empty-serializer are never serialized and are @@ -657,13 +698,15 @@ (define-configuration/no-serialization mympd-configuration empty-serializer) (user - (string "mympd") + (maybe-user-account %mympd-user) "Owner of the @command{mympd} process." + (sanitizer mympd-user-sanitizer) empty-serializer) (group - (string "nogroup") + (maybe-user-group %mympd-group) "Owner group of the @command{mympd} process." + (sanitizer mympd-group-sanitizer) empty-serializer) (work-directory @@ -798,7 +841,8 @@ (define (mympd-shepherd-service config) (match-record config (package shepherd-requirement user work-directory cache-directory log-level log-to) - (let ((log-level* (format #f "MYMPD_LOGLEVEL=~a" log-level))) + (let ((log-level* (format #f "MYMPD_LOGLEVEL=~a" log-level)) + (username (user-account-name user))) (shepherd-service (documentation "Run the myMPD daemon.") (requirement `(loopback user-processes @@ -806,7 +850,7 @@ (define (mympd-shepherd-service config) ,@shepherd-requirement)) (provision '(mympd)) (start #~(begin - (let* ((pw (getpwnam #$user)) + (let* ((pw (getpwnam #$username)) (uid (passwd:uid pw)) (gid (passwd:gid pw))) (for-each (lambda (dir) @@ -816,7 +860,7 @@ (define (mympd-shepherd-service config) (make-forkexec-constructor `(#$(file-append package "/bin/mympd") - "--user" #$user + "--user" #$username #$@(if (eqv? log-to 'syslog) '("--syslog") '()) "--workdir" #$work-directory "--cachedir" #$cache-directory) @@ -826,14 +870,7 @@ (define (mympd-shepherd-service config) (define (mympd-accounts config) (match-record config (user group) - (list (user-group (name group) - (system? #t)) - (user-account (name user) - (group group) - (system? #t) - (comment "myMPD user") - (home-directory "/var/empty") - (shell (file-append shadow "/sbin/nologin")))))) + (list user group))) (define (mympd-log-rotation config) (match-record config (log-to) -- 2.39.1 From unknown Fri Jun 20 07:19:24 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#62298] [PATCH 4/8] services: mympd: Require 'syslog service when configured to log to syslog. Resent-From: Bruno Victal Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 20 Mar 2023 17:15:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 62298 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 62298@debbugs.gnu.org Cc: ludo@gnu.org, Bruno Victal , liliana.prikler@gmail.com, maxim.cournoyer@gmail.com Received: via spool by 62298-submit@debbugs.gnu.org id=B62298.167933247312178 (code B ref 62298); Mon, 20 Mar 2023 17:15:02 +0000 Received: (at 62298) by debbugs.gnu.org; 20 Mar 2023 17:14:33 +0000 Received: from localhost ([127.0.0.1]:55658 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1peJ5d-0003AM-BN for submit@debbugs.gnu.org; Mon, 20 Mar 2023 13:14:33 -0400 Received: from smtpm4.myservices.hosting ([185.26.105.235]:35756) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1peJ5c-0003AE-1V for 62298@debbugs.gnu.org; Mon, 20 Mar 2023 13:14:32 -0400 Received: from mail1.netim.hosting (unknown [185.26.106.173]) by smtpm4.myservices.hosting (Postfix) with ESMTP id 828ED20BC1; Mon, 20 Mar 2023 18:14:29 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by mail1.netim.hosting (Postfix) with ESMTP id 62DD88009E; Mon, 20 Mar 2023 18:07:17 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at mail1.netim.hosting Received: from mail1.netim.hosting ([127.0.0.1]) by localhost (mail1-2.netim.hosting [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id ZFD3oQe32eEQ; Mon, 20 Mar 2023 18:07:17 +0100 (CET) Received: from guix-nuc.home.arpa (bl9-119-177.dsl.telepac.pt [85.242.119.177]) (Authenticated sender: lumen@makinata.eu) by mail1.netim.hosting (Postfix) with ESMTPSA id AE066800A4; Mon, 20 Mar 2023 18:07:16 +0100 (CET) From: Bruno Victal Date: Mon, 20 Mar 2023 17:07:09 +0000 Message-Id: <5d9e5cc507601cdd696f00a5dd14d3210e00186b.1679332019.git.mirai@makinata.eu> X-Mailer: git-send-email 2.39.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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/audio.scm (mympd-shepherd-service): Depend on 'syslog when configured to log to syslog. --- gnu/services/audio.scm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gnu/services/audio.scm b/gnu/services/audio.scm index e9ecccd614..e5b065a479 100644 --- a/gnu/services/audio.scm +++ b/gnu/services/audio.scm @@ -749,7 +749,9 @@ (define (mympd-shepherd-service config) (let ((log-level* (format #f "MYMPD_LOGLEVEL=~a" log-level))) (shepherd-service (documentation "Run the myMPD daemon.") - (requirement `(loopback user-processes ,@shepherd-requirement)) + (requirement `(loopback user-processes + ,@(if (eqv? log-to 'syslog) '(syslog) '()) + ,@shepherd-requirement)) (provision '(mympd)) (start #~(begin (let* ((pw (getpwnam #$user)) -- 2.39.1 From unknown Fri Jun 20 07:19:24 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#62298] [PATCH 7/8] services: mpd: Use user-account (resp. user-group) for user (resp. group) fields. Resent-From: Liliana Marie Prikler Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 20 Mar 2023 19:34:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 62298 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Bruno Victal , 62298@debbugs.gnu.org Cc: ludo@gnu.org, maxim.cournoyer@gmail.com Received: via spool by 62298-submit@debbugs.gnu.org id=B62298.167934079512567 (code B ref 62298); Mon, 20 Mar 2023 19:34:01 +0000 Received: (at 62298) by debbugs.gnu.org; 20 Mar 2023 19:33:15 +0000 Received: from localhost ([127.0.0.1]:56848 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1peLFr-0003Gd-C2 for submit@debbugs.gnu.org; Mon, 20 Mar 2023 15:33:15 -0400 Received: from mail-ed1-f68.google.com ([209.85.208.68]:37680) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1peLFp-0003GQ-7X for 62298@debbugs.gnu.org; Mon, 20 Mar 2023 15:33:13 -0400 Received: by mail-ed1-f68.google.com with SMTP id cn12so5529558edb.4 for <62298@debbugs.gnu.org>; Mon, 20 Mar 2023 12:33:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679340787; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:from:to:cc:subject :date:message-id:reply-to; bh=A9LwoFZUTtk4h5N2MZuhQOWF0+EVuYR8kUlZpmqGC/4=; b=JFtKpbVcbXa8VjKrgOnMIcm7MUk+AJCgkGPQS26juN+taM0ICgN6oUk0TKYLFcLaLn 6BcjAy4+R9kBJw296KZ24Y8subKg2pLLpjzPxq7QEFwJJ1b+Tt6TpMKyFEdGoaRPza+7 A2Fpspo8Q1FpGRBIykQkUWUzkHk0kEVJ7SrGuEi3muim9Y10Jv+FaAA/wWjwPDv8oZYr hh+1DlNckdwRoeRZGAxIO1fJB3aj6d/gLp4NxqBCMEnP0XXbCJQbf9rhda8ze/50PoMv /yiiwHCgN2odR7n31T+boF4Wp5H2EMjp0sdDjKUufs0ZQrTBAJW9Lxo3/JAczyCrITGP foug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679340787; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=A9LwoFZUTtk4h5N2MZuhQOWF0+EVuYR8kUlZpmqGC/4=; b=6LeVkM/b3IZBMm6Jrz/BMByP4vcsml7+wRf8+Bb6YlKAyiNv5EP2CEdSZxwm4032Fd QzmeixJ4hdhbzJmEhUwBOA6Mvi3taBJm0CTs/mJKbb/7uBy8kscnL49Z8wX2dmPN45cy 4eXCXZ7fd2oYE9o4fFnJ+d1TNaDu5LSav15HNPJpQmbMkK/GxzxOhPzZTC+i0yC3VHiz 4Sqf5zMfmJXE0pg8zmJVtRwWSOD/SAeMF+EP5WEJA6UZYLwk9cHMguS5tHdoMHoPA6Sx 4Yz1uL8DfMn58j6IaQyeEcPWqtoWpatZMLFtp/ZQrlVsqvvPbEnEHrj+jE1sc2aDwKQm mtHA== X-Gm-Message-State: AO0yUKX5L8ut/mP65r3QamU4M1LidDc4unrRWiZ5D6adw8dBzfsTMkbo TVpBh0bm5DWf0YHedkogpR8= X-Google-Smtp-Source: AK7set8Hb8r7UwhcT70iXqdgS0DxTzmBjv3gzVzyy52zZz++ORCURIFWzHIUQUzEuBDKjCNW2G0j1g== X-Received: by 2002:a17:906:4d56:b0:927:6e70:e245 with SMTP id b22-20020a1709064d5600b009276e70e245mr195873ejv.63.1679340787166; Mon, 20 Mar 2023 12:33:07 -0700 (PDT) Received: from lumine.fritz.box (85-127-52-93.dsl.dynamic.surfer.at. [85.127.52.93]) by smtp.gmail.com with ESMTPSA id g19-20020a17090613d300b00931db712768sm4621554ejc.4.2023.03.20.12.33.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Mar 2023 12:33:06 -0700 (PDT) Message-ID: <27ddb1989f281cee887c903955cc793fc34bd1ab.camel@gmail.com> From: Liliana Marie Prikler Date: Mon, 20 Mar 2023 20:33:05 +0100 In-Reply-To: <6e1da37de3839d56546389924ce47b4563d05d94.1679332019.git.mirai@makinata.eu> References: <6e1da37de3839d56546389924ce47b4563d05d94.1679332019.git.mirai@makinata.eu> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.46.0 MIME-Version: 1.0 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 (-) Am Montag, dem 20.03.2023 um 17:07 +0000 schrieb Bruno Victal: > Deprecate using strings for these fields and prefer user-account > (resp. user-group) instead to avoid duplication within account- > service-type. If a string value is encountered, it is ignored and a > predefined variable is used instead. This is essentially a rollback > to how it used to be before > '5c5f0fc1135ff15f9c4adfc5f27eadd9a592b5d1'. I already wrote this in private in IRC, but falling back to a constant when a string value is given is very silly. IIUC the reason to do so is because you would need to sanitize the user account and group at the same time so that the former has access to the latter. I think it's possible to use one of the following approaches to get a better result: 1. In (mpd-accounts), check if the user group equals the group name and raise a warning (or error) if not. 2. Use a special unique symbol, e.g. (make-symbol "%mpd-group") to denote the value to be lazily inserted by the serializer. Cheers From unknown Fri Jun 20 07:19:24 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#62298] [PATCH 8/8] services: mympd: Use user-account (resp. user-group) for user (resp. group) fields. Resent-From: Liliana Marie Prikler Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 20 Mar 2023 19:34:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 62298 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Bruno Victal , 62298@debbugs.gnu.org Cc: ludo@gnu.org, maxim.cournoyer@gmail.com Received: via spool by 62298-submit@debbugs.gnu.org id=B62298.167934083912625 (code B ref 62298); Mon, 20 Mar 2023 19:34:02 +0000 Received: (at 62298) by debbugs.gnu.org; 20 Mar 2023 19:33:59 +0000 Received: from localhost ([127.0.0.1]:56851 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1peLGY-0003HY-Np for submit@debbugs.gnu.org; Mon, 20 Mar 2023 15:33:58 -0400 Received: from mail-ed1-f66.google.com ([209.85.208.66]:44971) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1peLGX-0003HM-8r for 62298@debbugs.gnu.org; Mon, 20 Mar 2023 15:33:57 -0400 Received: by mail-ed1-f66.google.com with SMTP id eh3so51115182edb.11 for <62298@debbugs.gnu.org>; Mon, 20 Mar 2023 12:33:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679340831; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:from:to:cc:subject :date:message-id:reply-to; bh=3ZJNZAf5QX0Bpx8AW5k4LdjBlAdxm7HLD4tuvPZjYUY=; b=quG/CPQqZ9hXnejDooJ/xHA8UraWG3FS/kXxcrABE3+32IIXelI1qWp28GWRyRorl/ oFH+lAkXVL9OkMMw7Ue7nF5K46v+3Jhu5lFXLySfqORfFVPZe2r29z5WGLcJ0d/xPTl4 ZlNicwVMygW7WyLEV8Jq6ac/BQr701WBgUl9zhmWnMFmAiCK1TsQXUpH7gd91OCl8xow IJDZPcSHLV5ictoAZVIDVvkBM+Sm5yWtWqYx0MHU7f/igU9tybIv+NKi0q1oD+UykTcK 130IH8Bk7/zmLCxWrT3E5Nydw4r++FBj+54bckYNF5kBw+7+IWJvWy89CwvYQeasFH0s oiDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679340831; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=3ZJNZAf5QX0Bpx8AW5k4LdjBlAdxm7HLD4tuvPZjYUY=; b=ehhGEBX5U9zRYWPYkX2A5QR7JQskbgAQJbNnucKK4OesBY9an1y8WTk5j41oEwQm4B DL2WixfkEe8vvUaz5pKzPV8hdsdj5GOjg+7xhmtehi3PYweXYDN2aFwaAr9J/30DGdO7 rJnNE1+FtZ6vk09+vVcZ+u7TkWZq1/2lnVN7oEI9cIJGqBo9nWYVBUksgD+a5uAOUzJ3 9PKKWKJSnHMBMCJ4d+Ob30kRirzr39D5D7nG/K27p6A2ZEECjz5tGHHGNV3IVtUwJ74u lyDTp/MJqFy3O71T9nBqILUM258YkwXlwa3XzYuxS+q3MXpzK6MwSUGJgQUIRAOw8OVI vRug== X-Gm-Message-State: AO0yUKWrgHC+biw22tV5nc/+hp/yKnev+HfhhSTwJ/ipM6P9SSw1sJ7D Xe8Q5l8baR5BFwEVADlGL8HrXN5SLUICNA== X-Google-Smtp-Source: AK7set+sN/hHScac0kUHe76372DYurrsa6IQcW3HcFmvjd9IkrCkphWhIhb2Q1vm62JK+euWC7YITQ== X-Received: by 2002:a17:906:5857:b0:88a:cbd1:e663 with SMTP id h23-20020a170906585700b0088acbd1e663mr268707ejs.6.1679340831400; Mon, 20 Mar 2023 12:33:51 -0700 (PDT) Received: from lumine.fritz.box (85-127-52-93.dsl.dynamic.surfer.at. [85.127.52.93]) by smtp.gmail.com with ESMTPSA id i13-20020a170906114d00b008e0bb004976sm4783928eja.134.2023.03.20.12.33.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Mar 2023 12:33:51 -0700 (PDT) Message-ID: From: Liliana Marie Prikler Date: Mon, 20 Mar 2023 20:33:50 +0100 In-Reply-To: <48b9090890e5a03710bccaa9b48967c3db5560fd.1679332019.git.mirai@makinata.eu> References: <48b9090890e5a03710bccaa9b48967c3db5560fd.1679332019.git.mirai@makinata.eu> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.46.0 MIME-Version: 1.0 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 (-) Am Montag, dem 20.03.2023 um 17:07 +0000 schrieb Bruno Victal: > * gnu/services/audio.scm (%mympd-user, %mympd-group): New variable. > (mympd-user-sanitizer, mympd-group-sanitizer): New procedure. > (mympd-configuration)[user, group]: Set value type to user-account > (resp. user-group). > (mympd-serialize-configuration): Adapt for user-account values in > user field. > (mympd-accounts): Adapt for user-account (resp. user-group) in user > (resp. group) field. Same as 7/8, don't use glorified constants. Cheers From unknown Fri Jun 20 07:19:24 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#62298] [PATCH 1/8] services: configuration: Add user-defined sanitizer support. Resent-From: Liliana Marie Prikler Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 20 Mar 2023 19:44:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 62298 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Bruno Victal , 62298@debbugs.gnu.org Cc: ludo@gnu.org, maxim.cournoyer@gmail.com Received: via spool by 62298-submit@debbugs.gnu.org id=B62298.167934141913445 (code B ref 62298); Mon, 20 Mar 2023 19:44:02 +0000 Received: (at 62298) by debbugs.gnu.org; 20 Mar 2023 19:43:39 +0000 Received: from localhost ([127.0.0.1]:56856 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1peLPu-0003Um-QR for submit@debbugs.gnu.org; Mon, 20 Mar 2023 15:43:39 -0400 Received: from mail-ed1-f65.google.com ([209.85.208.65]:33576) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1peLPs-0003UZ-A0 for 62298@debbugs.gnu.org; Mon, 20 Mar 2023 15:43:37 -0400 Received: by mail-ed1-f65.google.com with SMTP id i5so4355941eda.0 for <62298@debbugs.gnu.org>; Mon, 20 Mar 2023 12:43:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679341410; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:from:to:cc:subject :date:message-id:reply-to; bh=nGMT5oY2OP3e8Rn4HOQSXMTpEYuadSC94i9jMqFfhfc=; b=mIcML6HnmXBtkdcDdGnfuzbe8n4ybpGz7sbJxu6UU4l4/oOvoQ4AszAneShFIiBe9T C7hDRTLLZeGYOafCkeoQPImSZN6nP2Y+7PDzYYgAlVfmj3/ltzfjZJLBovGjkKEbxWcB UIzEzGQUrEBL2mMwOiazDn3Cwtx4IRYjzSMSy00GgV6rHGCsTC9v1iK7L33wI6tz+UFe 2pKA6Xmiri7amqIY0O06AZrrepP976hSHA4urur+dl3jXHDrYKEgcDlM+c6Tn6FCIIr5 uo0SIs4x9Z1CXm+1pIMWwwKgBZT5aBzdyZClJnGY4qORUKrL6NAAQlpgfG1LlTQbWPSH IgTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679341410; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=nGMT5oY2OP3e8Rn4HOQSXMTpEYuadSC94i9jMqFfhfc=; b=ikyunuXbyJ1HQrIqza4FID07i6kAt1o/sfdttloIbSA8KKNmB8u3MIbHqDGgdQHiI8 EncZKYeGzf4mN2O9fg8d4W7B0bqL3m3bwlUre14mLKJ47pCmtDMmbTDQlGjVhSddczpP kTa61kc4DVaBDhiLqBIH6fC4UQ8exK+XD22+ffR8LSDDKdF9aWX4b4ehfgrT0y6pwuFQ haV42/Gam+O6OQRpS7CAstpH0OHV1egAdYOE6zpCeBSh2IK/TpIoUtTHbl18gHoTI68Q XDlvZALJjhK3qIZexLo/LQGjQPKu56rll21K30HQFGXqYv4p39eDdA6yAX/ZTGjT98gj gBig== X-Gm-Message-State: AO0yUKUrp0gcgNzd8IwItNTEhQus/m2FCkJBthiaGf5PEdE+bXEv7Qfn MKezfP9y2OuwmPvR+LwJntM= X-Google-Smtp-Source: AK7set9NfxQlk/Q4Keq3vOGSG/qd0Xelq3S4IdFwo9xi7uZzdPiX4pDw8WY+zMGcCK775e8xIpNHqQ== X-Received: by 2002:a05:6402:205b:b0:4fb:e9b8:ca56 with SMTP id bc27-20020a056402205b00b004fbe9b8ca56mr602469edb.41.1679341410403; Mon, 20 Mar 2023 12:43:30 -0700 (PDT) Received: from lumine.fritz.box (85-127-52-93.dsl.dynamic.surfer.at. [85.127.52.93]) by smtp.gmail.com with ESMTPSA id s24-20020a508d18000000b00501d489f798sm680061eds.35.2023.03.20.12.43.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Mar 2023 12:43:30 -0700 (PDT) Message-ID: <2b2ab14bbfb9c46653ee1eddd7d9ec14fd238c41.camel@gmail.com> From: Liliana Marie Prikler Date: Mon, 20 Mar 2023 20:43:29 +0100 In-Reply-To: <2f7b29de4dacdee7e60ede8830a67c643122c302.1679332019.git.mirai@makinata.eu> References: <2f7b29de4dacdee7e60ede8830a67c643122c302.1679332019.git.mirai@makinata.eu> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: base64 User-Agent: Evolution 3.46.0 MIME-Version: 1.0 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 (-) QW0gTW9udGFnLCBkZW0gMjAuMDMuMjAyMyB1bSAxNzowNyArMDAwMCBzY2hyaWViIEJydW5vIFZp Y3RhbDoKPiArwqAgOzsgVGhlIGdldC3igKYgcHJvY2VkdXJlcyBwZXJmb3JtIHNjYW5uaW5nIHRv IEB2YXJ7ZXh0cmEtYXJnc30gdG8KPiBhbGxvdyBmb3IKPiArwqAgOzsgbmV3bHkgYWRkZWQgZmll bGRzIHRvIGJlIHNwZWNpZmllZCBpbiBhcmJpdHJhcnkgb3JkZXIuCj4gK8KgIChkZWZpbmUgKGdl dC1zYW5pdGl6ZXIgcykKPiArwqDCoMKgIChzeW50YXgtY2FzZSBzIChzYW5pdGl6ZXIpCj4gK8Kg wqDCoMKgwqAgKCgoc2FuaXRpemVyIHByb2MpIF8gLi4uKQo+ICvCoMKgwqDCoMKgwqAgIydwcm9j KQo+ICvCoMKgwqDCoMKgICgoXyB0YWlsIC4uLikKPiArwqDCoMKgwqDCoMKgIChnZXQtc2FuaXRp emVyICMnKHRhaWwgLi4uKSkpCj4gK8KgwqDCoMKgwqAgKCgpICV1bnNldC12YWx1ZSkpKQo+ICsK PiArwqAgKGRlZmluZSAoZ2V0LXNlcmlhbGl6ZXIgcykKPiArwqDCoMKgIChzeW50YXgtY2FzZSBz IChzZXJpYWxpemVyIGVtcHR5LXNlcmlhbGl6ZXIpCj4gK8KgwqDCoMKgwqAgKCgoc2VyaWFsaXpl ciBwcm9jKSBfIC4uLikKPiArwqDCoMKgwqDCoMKgICMncHJvYykKPiArwqDCoMKgwqDCoCAoKGVt cHR5LXNlcmlhbGl6ZXIgXyAuLi4pCj4gK8KgwqDCoMKgwqDCoCAjJ2VtcHR5LXNlcmlhbGl6ZXIp Cj4gK8KgwqDCoMKgwqAgKChfIHRhaWwgLi4uKQo+ICvCoMKgwqDCoMKgwqAgKGdldC1zZXJpYWxp emVyICMnKHRhaWwgLi4uKSkpCj4gK8KgwqDCoMKgwqAgKCgpICV1bnNldC12YWx1ZSkpKQpJbnN0 ZWFkIG9mIGRvaW5nIHR3byBwYXNzZXMsIHRyeSB1c2luZyBnb29kIG9sZCBuYW1lZCBsZXQgdG8g bG9vcCBvdmVyCnMgYW5kIGdldCBzZXJpYWxpemVyIGFuZCBzYW5pdGl6ZXIgaW4gb25lIGdvLiAg VXNlICNmIGZvciB0aGVpcgpkZWZhdWx0cyBzbyB5b3UgY2FuIGRvIChvciBzZXJpYWxpemVyICMn ZW1wdHktc2VyaWFsaXplcikgYW5kIChvcgpzYW5pdGl6ZXIgJXVuc2V0LXZhbHVlKS4KCj4gwqDC oCAoc3ludGF4LWNhc2Ugc3luICgpCj4gLcKgwqDCoCAoKF8gc3RlbSAoZmllbGQgZmllbGQtdHlw ZStkZWYgZG9jIGN1c3RvbS1zZXJpYWxpemVyIC4uLikgLi4uKQo+ICvCoMKgwqAgKChfIHN0ZW0g KGZpZWxkIGZpZWxkLXR5cGUrZGVmIGRvYyBleHRyYS1hcmdzIC4uLikgLi4uKQo+IMKgwqDCoMKg wqAgKHdpdGgtc3ludGF4Cj4gwqDCoMKgwqDCoMKgwqDCoMKgICgoKChmaWVsZC10eXBlIGRlZikg Li4uKQo+IMKgwqDCoMKgwqDCoMKgwqDCoMKgwqAgKG1hcCBub3JtYWxpemUtZmllbGQtdHlwZStk ZWYgIycoZmllbGQtdHlwZStkZWYgLi4uKSkpKQo+IEBAIC0yMDAsMjEgKzI0MiwyMyBAQCAoZGVm aW5lIChkZWZpbmUtY29uZmlndXJhdGlvbi1oZWxwZXIgc2VyaWFsaXplPwo+IHNlcmlhbGl6ZXIt cHJlZml4IHN5bikKPiDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgICgo ZmllbGQtdHlwZSBkZWZhdWx0LXZhbHVlKQo+IMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDC oMKgwqDCoMKgwqDCoCBkZWZhdWx0LXZhbHVlKSkKPiDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDC oMKgwqDCoMKgwqAgIycoKGZpZWxkLXR5cGUgZGVmKSAuLi4pKSkKPiArwqDCoMKgwqDCoMKgwqDC oMKgwqDCoCAoKGZpZWxkLXNhbml0aXplciAuLi4pCj4gK8KgwqDCoMKgwqDCoMKgwqDCoMKgwqDC oCAobWFwIChjb21wb3NlIG1heWJlLXZhbHVlIGdldC1zYW5pdGl6ZXIpCj4gK8KgwqDCoMKgwqDC oMKgwqDCoMKgwqDCoMKgwqDCoMKgwqAgIycoKGV4dHJhLWFyZ3MgLi4uKSAuLi4pKSkKPiDCoMKg wqDCoMKgwqDCoMKgwqDCoMKgwqAgKChmaWVsZC1zZXJpYWxpemVyIC4uLikKPiAtwqDCoMKgwqDC oMKgwqDCoMKgwqDCoMKgIChtYXAgKGxhbWJkYSAodHlwZSBjdXN0b20tc2VyaWFsaXplcikKPiAr wqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgIChtYXAgKGxhbWJkYSAodHlwZSBleHRyYS1hcmdzKQo+ IMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqAgKGFuZCBzZXJpYWxpemU/ Cj4gLcKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoCAobWF0 Y2ggY3VzdG9tLXNlcmlhbGl6ZXIKPiAtwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDC oMKgwqDCoMKgwqDCoMKgwqDCoCAoKHNlcmlhbGl6ZXIpCj4gLcKgwqDCoMKgwqDCoMKgwqDCoMKg wqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoCBzZXJpYWxpemVyKQo+IC3CoMKgwqDC oMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgICgoKQo+IC3CoMKg wqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqAgKGlmIHNl cmlhbGl6ZXItcHJlZml4Cj4gLcKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKg wqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgIChpZCAjJ3N0ZW0KPiAtwqDCoMKgwqDCoMKgwqDCoMKg wqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoCBzZXJp YWxpemVyLXByZWZpeAo+IC3CoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKg wqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgICMnc2VyaWFsaXplLSB0eXBlKQo+IC3CoMKg wqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDC oCAoaWQgIydzdGVtICMnc2VyaWFsaXplLSB0eXBlKSkpKSkpCj4gK8KgwqDCoMKgwqDCoMKgwqDC oMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoCAob3IKPiArwqDCoMKgwqDCoMKgwqDCoMKg wqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqAgKGlmIChkZXByZWNhdGVkLXN0eWxlLXNl cmlhbGl6ZXI/IGV4dHJhLQo+IGFyZ3MpCj4gK8KgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDC oMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqAgKGNhciBleHRyYS1hcmdzKcKgIDsgc3RyaXAg b3V0ZXIKPiBwYXJlbnRoZXNpcwo+ICvCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKg wqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgICNmKQo+ICvCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDC oMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoCAobWF5YmUtdmFsdWUgKGdldC1zZXJpYWxpemVyIGV4 dHJhLWFyZ3MpKQo+ICvCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDC oMKgwqDCoCAoaWYgc2VyaWFsaXplci1wcmVmaXgKPiArwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKg wqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoCAoaWQgIydzdGVtIHNlcmlhbGl6ZXIt cHJlZml4Cj4gIydzZXJpYWxpemUtIHR5cGUpCj4gK8KgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKg wqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqAgKGlkICMnc3RlbSAjJ3NlcmlhbGl6ZS0g dHlwZSkpKSkpCj4gwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgICMnKGZpZWxk LXR5cGUgLi4uKQo+IC3CoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgICMnKChjdXN0 b20tc2VyaWFsaXplciAuLi4pIC4uLikpKSkKPiAtwqDCoMKgwqDCoMKgwqDCoCAoZGVmaW5lIChm aWVsZC1zYW5pdGl6ZXIgbmFtZSBwcmVkKQo+ICvCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKg wqDCoMKgICMnKChleHRyYS1hcmdzIC4uLikgLi4uKSkpKQo+ICvCoMKgwqDCoMKgwqDCoMKgIChk ZWZpbmUgKGRlZmF1bHQtZmllbGQtc2FuaXRpemVyIG5hbWUgcHJlZCkKPiDCoMKgwqDCoMKgwqDC oMKgwqDCoMKgIDs7IERlZmluZSBhIG1hY3JvIGZvciB1c2UgYXMgYSByZWNvcmQgZmllbGQgc2Fu aXRpemVyLAo+IHdoZXJlIE5BTUUKPiDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgIDs7IGlzIHRoZSBu YW1lIG9mIHRoZSBmaWVsZCBhbmQgUFJFRCBpcyB0aGUgcHJlZGljYXRlCj4gdGhhdCB0ZWxscwo+ IMKgwqDCoMKgwqDCoMKgwqDCoMKgwqAgOzsgd2hldGhlciBhIHZhbHVlIGlzIHZhbGlkIGZvciB0 aGlzIGZpZWxkLgo+IEBAIC0yMzUsMjEgKzI3OSwyOSBAQCAoZGVmaW5lIChkZWZpbmUtY29uZmln dXJhdGlvbi1oZWxwZXIgc2VyaWFsaXplPwo+IHNlcmlhbGl6ZXItcHJlZml4IHN5bikKPiDCoAo+ IMKgwqDCoMKgwqDCoMKgwqDCoCAjYChiZWdpbgo+IMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKg IDs7IERlZmluZSBmaWVsZCB2YWxpZGF0aW9uIG1hY3Jvcy4KPiAtwqDCoMKgwqDCoMKgwqDCoMKg wqDCoMKgICMsQChtYXAgZmllbGQtc2FuaXRpemVyCj4gLcKgwqDCoMKgwqDCoMKgwqDCoMKgwqDC oMKgwqDCoMKgwqDCoMKgwqAgIycoZmllbGQgLi4uKQo+IC3CoMKgwqDCoMKgwqDCoMKgwqDCoMKg wqDCoMKgwqDCoMKgwqDCoMKgICMnKGZpZWxkLXByZWRpY2F0ZSAuLi4pKQo+ICvCoMKgwqDCoMKg wqDCoMKgwqDCoMKgwqAgIyxAKGZpbHRlci1tYXAgKGxhbWJkYSAobmFtZSBwcmVkIHNhbml0aXpl cikKPiArwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDC oMKgwqDCoCAoaWYgc2FuaXRpemVyCj4gK8KgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKg wqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoCAjZgo+ICvCoMKgwqDCoMKgwqDCoMKg wqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqAgKGRlZmF1 bHQtZmllbGQtc2FuaXRpemVyIG5hbWUKPiBwcmVkKSkpCj4gK8KgwqDCoMKgwqDCoMKgwqDCoMKg wqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoCAjJyhmaWVsZCAuLi4pCj4gK8KgwqDC oMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoCAjJyhmaWVs ZC1wcmVkaWNhdGUgLi4uKQo+ICvCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDC oMKgwqDCoMKgwqDCoMKgwqAgIycoZmllbGQtc2FuaXRpemVyIC4uLikpCj4gwqAKPiDCoMKgwqDC oMKgwqDCoMKgwqDCoMKgwqDCoCAoZGVmaW5lLXJlY29yZC10eXBlKiAjLChpZCAjJ3N0ZW0gIyc8 ICMnc3RlbSAjJz4pCj4gwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgIHN0ZW0KPiDCoMKg wqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqAgIywoaWQgIydzdGVtICMnbWFrZS0gIydzdGVtKQo+ IMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoCAjLChpZCAjJ3N0ZW0gIydzdGVtICMnPykK PiAtwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoCAjLEAobWFwIChsYW1iZGEgKG5hbWUgZ2V0 dGVyIGRlZikKPiAtwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDC oMKgICNgKCMsbmFtZSAjLGdldHRlciAoZGVmYXVsdCAjLGRlZikKPiArwqDCoMKgwqDCoMKgwqDC oMKgwqDCoMKgwqDCoCAjLEAobWFwIChsYW1iZGEgKG5hbWUgZ2V0dGVyIGRlZiBzYW5pdGl6ZXIp Cj4gK8KgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoCAjYCgj LG5hbWUgIyxnZXR0ZXIKPiArwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDC oMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqAgKGRlZmF1bHQgIyxkZWYpCj4gwqDCoMKgwqDC oMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKg wqDCoCAoc2FuaXRpemUKPiAtwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDC oMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoCAjLChpZCAjJ3N0ZW0gIyd2YWxpZGF0ZS0g IydzdGVtCj4gIyctIG5hbWUpKSkpCj4gK8KgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKg wqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqAgIywob3Igc2FuaXRpemVyCj4g K8KgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKg wqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqAgKGlkICMnc3RlbQo+ICvCoMKgwqDCoMKgwqDCoMKg wqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDC oMKgwqDCoMKgwqDCoMKgwqAgIyd2YWxpZGF0ZS0gIydzdGVtICMnLQo+IG5hbWUpKSkpKQo+IMKg wqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqAgIycoZmllbGQgLi4u KQo+IMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqAgIycoZmll bGQtZ2V0dGVyIC4uLikKPiAtwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDC oMKgwqAgIycoZmllbGQtZGVmYXVsdCAuLi4pKQo+ICvCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDC oMKgwqDCoMKgwqDCoMKgwqDCoCAjJyhmaWVsZC1kZWZhdWx0IC4uLikKPiArwqDCoMKgwqDCoMKg wqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqAgIycoZmllbGQtc2FuaXRpemVyIC4uLikp Cj4gwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgICglbG9jYXRpb24gIywoaWQgIydzdGVt ICMnc3RlbSAjJy1zb3VyY2UtbG9jYXRpb24pCj4gwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDC oMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoCAoZGVmYXVsdCAoYW5kPT4gKGN1cnJlbnQtc291cmNl LWxvY2F0aW9uKQo+IMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKg wqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoCBzb3VyY2UtcHJvcGVydGll cy0KPiA+bG9jYXRpb24pKQo+IEBAIC0yNjEsNiArMzEzLDkgQEAgKGRlZmluZSAoZGVmaW5lLWNv bmZpZ3VyYXRpb24taGVscGVyIHNlcmlhbGl6ZT8KPiBzZXJpYWxpemVyLXByZWZpeCBzeW4pCj4g wqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqAgKHR5cGUgJ2ZpZWxk LXR5cGUpCj4gwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqAgKGdl dHRlciBmaWVsZC1nZXR0ZXIpCj4gwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKg wqDCoMKgwqAgKHByZWRpY2F0ZSBmaWVsZC1wcmVkaWNhdGUpCj4gK8KgwqDCoMKgwqDCoMKgwqDC oMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoCAoc2FuaXRpemVyCj4gK8KgwqDCoMKgwqDCoMKgwqDC oMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgIChvciBmaWVsZC1zYW5pdGl6ZXIKPiArwqDCoMKg wqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoCAoaWQgIydzdGVt ICMndmFsaWRhdGUtICMnc3RlbSAjJy0KPiAjJ2ZpZWxkKSkpCj4gwqDCoMKgwqDCoMKgwqDCoMKg wqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqAgKHNlcmlhbGl6ZXIgZmllbGQtc2VyaWFsaXplcikK PiDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoCAoZGVmYXVsdC12 YWx1ZS10aHVuawo+IMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKg wqDCoCAobGFtYmRhICgpCj4gZGlmZiAtLWdpdCBhL3Rlc3RzL3NlcnZpY2VzL2NvbmZpZ3VyYXRp b24uc2NtCj4gYi90ZXN0cy9zZXJ2aWNlcy9jb25maWd1cmF0aW9uLnNjbQo+IGluZGV4IDRmOGE3 NGRjOGEuLmM1NTY5YTllNTAgMTAwNjQ0Cj4gLS0tIGEvdGVzdHMvc2VydmljZXMvY29uZmlndXJh dGlvbi5zY20KPiArKysgYi90ZXN0cy9zZXJ2aWNlcy9jb25maWd1cmF0aW9uLnNjbQo+IEBAIC0y LDYgKzIsNyBAQAo+IMKgOzs7IENvcHlyaWdodCDCqSAyMDIxLCAyMDIyIE1heGltIENvdXJub3ll cgo+IDxtYXhpbS5jb3Vybm95ZXJAZ21haWwuY29tPgo+IMKgOzs7IENvcHlyaWdodCDCqSAyMDIx IFhpbmdsdSBDaGVuIDxwdWJsaWNAeW9jdG9jZWxsLnh5ej4KPiDCoDs7OyBDb3B5cmlnaHQgwqkg MjAyMiBMdWRvdmljIENvdXJ0w6hzIDxsdWRvQGdudS5vcmc+Cj4gKzs7OyBDb3B5cmlnaHQgwqkg MjAyMyBCcnVubyBWaWN0YWwgPG1pcmFpQG1ha2luYXRhLmV1Pgo+IMKgOzs7Cj4gwqA7OzsgVGhp cyBmaWxlIGlzIHBhcnQgb2YgR05VIEd1aXguCj4gwqA7OzsKPiBAQCAtMjIsNiArMjMsNyBAQCAo ZGVmaW5lLW1vZHVsZSAodGVzdHMgc2VydmljZXMgY29uZmlndXJhdGlvbikKPiDCoMKgICM6dXNl LW1vZHVsZSAoZ251IHNlcnZpY2VzIGNvbmZpZ3VyYXRpb24pCj4gwqDCoCAjOnVzZS1tb2R1bGUg KGd1aXggZGlhZ25vc3RpY3MpCj4gwqDCoCAjOnVzZS1tb2R1bGUgKGd1aXggZ2V4cCkKPiArwqAg IzphdXRvbG9hZCAoZ3VpeCBpMThuKSAoR18pCj4gwqDCoCAjOnVzZS1tb2R1bGUgKHNyZmkgc3Jm aS0zNCkKPiDCoMKgICM6dXNlLW1vZHVsZSAoc3JmaSBzcmZpLTY0KSkKPiDCoAo+IEBAIC00Niwx NCArNDgsMTQgQEAgKGRlZmluZS1jb25maWd1cmF0aW9uIHBvcnQtY29uZmlndXJhdGlvbgo+IMKg wqAgKHBvcnQtY29uZmlndXJhdGlvbi1wb3J0IChwb3J0LWNvbmZpZ3VyYXRpb24pKSkKPiDCoAo+ IMKgKHRlc3QtZXF1YWwgIndyb25nIHR5cGUgZm9yIGEgZmllbGQiCj4gLcKgICcoImNvbmZpZ3Vy YXRpb24uc2NtIiA1NyAxMSnCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoCA7 ZXJyb3IgbG9jYXRpb24KPiArwqAgJygiY29uZmlndXJhdGlvbi5zY20iIDU5IDExKcKgwqDCoMKg wqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgIDtlcnJvciBsb2NhdGlvbgo+IMKgwqAgKGd1 YXJkIChjICgoY29uZmlndXJhdGlvbi1lcnJvcj8gYykKPiDCoMKgwqDCoMKgwqDCoMKgwqDCoMKg wqDCoCAobGV0ICgobG9jIChlcnJvci1sb2NhdGlvbiBjKSkpCj4gwqDCoMKgwqDCoMKgwqDCoMKg wqDCoMKgwqDCoMKgIChsaXN0IChiYXNlbmFtZSAobG9jYXRpb24tZmlsZSBsb2MpKQo+IMKgwqDC oMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoCAobG9jYXRpb24tbGluZSBsb2Mp Cj4gwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgIChsb2NhdGlvbi1j b2x1bW4gbG9jKSkpKSkKPiDCoMKgwqDCoCAocG9ydC1jb25maWd1cmF0aW9uCj4gLcKgwqDCoMKg IDs7IFRoaXMgaXMgbGluZSA1NjsgdGhlIHRlc3QgcmVsaWVzIG9uIGxpbmUvY29sdW1uIG51bWJl cnMhCj4gK8KgwqDCoMKgIDs7IFRoaXMgaXMgbGluZSA1ODsgdGhlIHRlc3QgcmVsaWVzIG9uIGxp bmUvY29sdW1uIG51bWJlcnMhCj4gwqDCoMKgwqDCoCAocG9ydCAiVGhpcyBpcyBub3QgYSBudW1i ZXIhIikpKSkKPiDCoAo+IMKgKGRlZmluZS1jb25maWd1cmF0aW9uIHBvcnQtY29uZmlndXJhdGlv bi1jcwo+IEBAIC0xMDksNiArMTExLDE0NSBAQCAoZGVmaW5lLWNvbmZpZ3VyYXRpb24gY29uZmln dXJhdGlvbi13aXRoLXByZWZpeAo+IMKgwqDCoCAobGV0ICgoY29uZmlnIChjb25maWd1cmF0aW9u LXdpdGgtcHJlZml4KSkpCj4gwqDCoMKgwqDCoCAoc2VyaWFsaXplLWNvbmZpZ3VyYXRpb24gY29u ZmlnIGNvbmZpZ3VyYXRpb24td2l0aC1wcmVmaXgtCj4gZmllbGRzKSkpKQo+IMKgCj4gKwwKPiAr Ozs7Cj4gKzs7OyBkZWZpbmUtY29uZmlndXJhdGlvbiBtYWNybywgZXh0cmEtYXJncyBsaXRlcmFs cwo+ICs7OzsKPiArCj4gKyhkZWZpbmUgKGV2YWwtZ2V4cCB4KQo+ICvCoCAiR2V0IHNlcmlhbGl6 ZWQgY29uZmlnIGFzIHN0cmluZy4iCj4gK8KgIChldmFsIChnZXhwLT5hcHByb3hpbWF0ZS1zZXhw IHgpCj4gK8KgwqDCoMKgwqDCoMKgIChjdXJyZW50LW1vZHVsZSkpKQo+ICsKPiArKGRlZmluZSAo cG9ydD8gdmFsdWUpCj4gK8KgIChvciAoc3RyaW5nPyB2YWx1ZSkgKG51bWJlcj8gdmFsdWUpKSkK PiArCj4gKyhkZWZpbmUgKHNhbml0aXplLXBvcnQgdmFsdWUpCj4gK8KgIChjb25kICgobnVtYmVy PyB2YWx1ZSkgdmFsdWUpCj4gK8KgwqDCoMKgwqDCoMKgICgoc3RyaW5nPyB2YWx1ZSkgKHN0cmlu Zy0+bnVtYmVyIHZhbHVlKSkKPiArwqDCoMKgwqDCoMKgwqAgKGVsc2UgKHJhaXNlIChmb3JtYXR0 ZWQtbWVzc2FnZSAoR18gIkJhZCB2YWx1ZTogfmEiKQo+IHZhbHVlKSkpKSkKPiArCj4gKyhsZXQg KCkKPiArwqAgOzsgQmFzaWMgc2FuaXRpemVyIGxpdGVyYWwgdGVzdHMKPiArCj4gK8KgIChkZWZp bmUgc2VyaWFsaXplLXBvcnQgc2VyaWFsaXplLW51bWJlcikKPiArCj4gK8KgIChkZWZpbmUtY29u ZmlndXJhdGlvbiBjb25maWctd2l0aC1zYW5pdGl6ZXIKPiArwqDCoMKgIChwb3J0Cj4gK8KgwqDC oMKgIChwb3J0IDgwKQo+ICvCoMKgwqDCoCAiTG9yZW0gSXBzdW0uIgo+ICvCoMKgwqDCoCAoc2Fu aXRpemVyIHNhbml0aXplLXBvcnQpKSkKPiArCj4gK8KgICh0ZXN0LWVxdWFsICJkZWZhdWx0IHZh bHVlLCBzYW5pdGl6ZXIiCj4gK8KgwqDCoCA4MAo+ICvCoMKgwqAgKGNvbmZpZy13aXRoLXNhbml0 aXplci1wb3J0IChjb25maWctd2l0aC1zYW5pdGl6ZXIpKSkKPiArCj4gK8KgICh0ZXN0LWVxdWFs ICJzdHJpbmcgdmFsdWUsIHNhbml0aXplZCB0byBudW1iZXIiCj4gK8KgwqDCoCA1Ngo+ICvCoMKg wqAgKGNvbmZpZy13aXRoLXNhbml0aXplci1wb3J0IChjb25maWctd2l0aC1zYW5pdGl6ZXIKPiAr wqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDC oMKgwqDCoCAocG9ydCAiNTYiKSkpKQo+ICsKPiArCj4gK8KgwqAgKGRlZmluZSAoY3VzdG9tLXNl cmlhbGl6ZS1wb3J0IGZpZWxkLW5hbWUgdmFsdWUpCj4gK8KgwqDCoMKgIChudW1iZXItPnN0cmlu ZyB2YWx1ZSkpCj4gKwo+ICvCoMKgIChkZWZpbmUtY29uZmlndXJhdGlvbiBjb25maWctc2VyaWFs aXplcgo+ICvCoMKgwqDCoCAocG9ydAo+ICvCoMKgwqDCoMKgIChwb3J0IDgwKQo+ICvCoMKgwqDC oMKgICJMb3JlbSBJcHN1bS4iCj4gK8KgwqDCoMKgwqAgKHNlcmlhbGl6ZXIgY3VzdG9tLXNlcmlh bGl6ZS1wb3J0KSkpCj4gKwo+ICvCoMKgICh0ZXN0LWVxdWFsICJkZWZhdWx0IHZhbHVlLCBzZXJp YWxpemVyIGxpdGVyYWwiCj4gK8KgwqDCoMKgICI4MCIKPiArwqDCoMKgwqAgKGV2YWwtZ2V4cAo+ ICvCoMKgwqDCoMKgIChzZXJpYWxpemUtY29uZmlndXJhdGlvbiAoY29uZmlnLXNlcmlhbGl6ZXIp Cj4gK8KgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDC oMKgwqDCoCBjb25maWctc2VyaWFsaXplci1maWVsZHMpKSkpCj4gKwo+ICsobGV0ICgpCj4gK8Kg IDs7IGVtcHR5LXNlcmlhbGl6ZXIgYXMgbGl0ZXJhbC9wcm9jZWR1cmUgdGVzdHMKPiArCj4gK8Kg IDs7IGVtcHR5LXNlcmlhbGl6ZXIgYXMgbGl0ZXJhbAo+ICvCoCAoZGVmaW5lLWNvbmZpZ3VyYXRp b24gY29uZmlnLXdpdGgtbGl0ZXJhbAo+ICvCoMKgwqAgKHBvcnQKPiArwqDCoMKgwqAgKHBvcnQg ODApCj4gK8KgwqDCoMKgICJMb3JlbSBJcHN1bS4iCj4gK8KgwqDCoMKgIGVtcHR5LXNlcmlhbGl6 ZXIpKQo+ICsKPiArwqAgOzsgZW1wdHktc2VyaWFsaXplciBhcyBwcm9jZWR1cmUKPiArwqAgKGRl ZmluZS1jb25maWd1cmF0aW9uIGNvbmZpZy13aXRoLXByb2MKPiArwqDCoMKgIChwb3J0Cj4gK8Kg wqDCoMKgIChwb3J0IDgwKQo+ICvCoMKgwqDCoCAiTG9yZW0gSXBzdW0uIgo+ICvCoMKgwqDCoCAo c2VyaWFsaXplciBlbXB0eS1zZXJpYWxpemVyKSkpCj4gKwo+ICvCoCAodGVzdC1lcXVhbCAiZW1w dHktc2VyaWFsaXplciBhcyBsaXRlcmFsIgo+ICvCoMKgwqAgIiIKPiArwqDCoMKgIChldmFsLWdl eHAKPiArwqDCoMKgwqAgKHNlcmlhbGl6ZS1jb25maWd1cmF0aW9uIChjb25maWctd2l0aC1saXRl cmFsKQo+ICvCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDC oMKgwqDCoMKgIGNvbmZpZy13aXRoLWxpdGVyYWwtZmllbGRzKSkpCj4gKwo+ICvCoCAodGVzdC1l cXVhbCAiZW1wdHktc2VyaWFsaXplciBhcyBwcm9jZWR1cmUiCj4gK8KgwqDCoCAiIgo+ICvCoMKg wqAgKGV2YWwtZ2V4cAo+ICvCoMKgwqDCoCAoc2VyaWFsaXplLWNvbmZpZ3VyYXRpb24gKGNvbmZp Zy13aXRoLXByb2MpCj4gK8KgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDC oMKgwqDCoMKgwqDCoMKgwqAgY29uZmlnLXdpdGgtcHJvYy1maWVsZHMpKSkpCj4gKwo+ICsobGV0 ICgpCj4gK8KgIDs7IHBlcm11dGF0aW9uIHRlc3RzCj4gKwo+ICvCoCAoZGVmaW5lLWNvbmZpZ3Vy YXRpb24gY29uZmlnLXNhbitlbXB0eS1zZXIKPiArwqDCoMKgIChwb3J0Cj4gK8KgwqDCoMKgIChw b3J0IDgwKQo+ICvCoMKgwqDCoCAiTG9yZW0gSXBzdW0uIgo+ICvCoMKgwqDCoCAoc2FuaXRpemVy IHNhbml0aXplLXBvcnQpCj4gK8KgwqDCoMKgIGVtcHR5LXNlcmlhbGl6ZXIpKQo+ICsKPiArwqAg KGRlZmluZS1jb25maWd1cmF0aW9uIGNvbmZpZy1zYW4rc2VyCj4gK8KgwqDCoCAocG9ydAo+ICvC oMKgwqDCoCAocG9ydCA4MCkKPiArwqDCoMKgwqAgIkxvcmVtIElwc3VtLiIKPiArwqDCoMKgwqAg KHNhbml0aXplciBzYW5pdGl6ZS1wb3J0KQo+ICvCoMKgwqDCoCAoc2VyaWFsaXplciAobGFtYmRh IF8gImZvbyIpKSkpCj4gKwo+ICvCoCAodGVzdC1lcXVhbCAiZGVmYXVsdCB2YWx1ZSwgc2FuaXRp emVyLCBwZXJtdXRhdGlvbiIKPiArwqDCoMKgIDgwCj4gK8KgwqDCoCAoY29uZmlnLXNhbitlbXB0 eS1zZXItcG9ydCAoY29uZmlnLXNhbitlbXB0eS1zZXIpKSkKPiArCj4gK8KgICh0ZXN0LWVxdWFs ICJkZWZhdWx0IHZhbHVlLCBzZXJpYWxpemVyLCBwZXJtdXRhdGlvbiIKPiArwqDCoMKgICJmb28i Cj4gK8KgwqDCoCAoZXZhbC1nZXhwCj4gK8KgwqDCoMKgIChzZXJpYWxpemUtY29uZmlndXJhdGlv biAoY29uZmlnLXNhbitzZXIpIGNvbmZpZy1zYW4rc2VyLQo+IGZpZWxkcykpKQo+ICsKPiArwqAg KHRlc3QtZXF1YWwgInN0cmluZyB2YWx1ZSwgc2FuaXRpemVkIHRvIG51bWJlciwgcGVybXV0YXRp b24iCj4gK8KgwqDCoCA1Ngo+ICvCoMKgwqAgKGNvbmZpZy1zYW4rc2VyLXBvcnQgKGNvbmZpZy1z YW4rc2VyCj4gK8KgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDC oMKgIChwb3J0ICI1NiIpKSkpCj4gKwo+ICvCoCA7OyBvcmRlcmluZyB0ZXN0cwo+ICvCoCAoZGVm aW5lLWNvbmZpZ3VyYXRpb24gY29uZmlnLXNlcitzYW4KPiArwqDCoMKgIChwb3J0Cj4gK8KgwqDC oMKgIChwb3J0IDgwKQo+ICvCoMKgwqDCoCAiTG9yZW0gSXBzdW0uIgo+ICvCoMKgwqDCoCAoc2Fu aXRpemVyIHNhbml0aXplLXBvcnQpCj4gK8KgwqDCoMKgIChzZXJpYWxpemVyIChsYW1iZGEgXyAi Zm9vIikpKSkKPiArCj4gK8KgIChkZWZpbmUtY29uZmlndXJhdGlvbiBjb25maWctZW1wdHktc2Vy K3Nhbgo+ICvCoMKgwqAgKHBvcnQKPiArwqDCoMKgwqAgKHBvcnQgODApCj4gK8KgwqDCoMKgICJM b3JlbSBJcHN1bS4iCj4gK8KgwqDCoMKgIGVtcHR5LXNlcmlhbGl6ZXIKPiArwqDCoMKgwqAgKHNh bml0aXplciBzYW5pdGl6ZS1wb3J0KSkpCj4gKwo+ICvCoCAodGVzdC1lcXVhbCAiZGVmYXVsdCB2 YWx1ZSwgc2FuaXRpemVyLCBwZXJtdXRhdGlvbiAyIgo+ICvCoMKgwqAgNTYKPiArwqDCoMKgIChj b25maWctZW1wdHktc2VyK3Nhbi1wb3J0IChjb25maWctZW1wdHktc2VyK3Nhbgo+ICvCoMKgwqDC oMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoCAo cG9ydCAiNTYiKSkpKQo+ICsKPiArwqAgKHRlc3QtZXF1YWwgImRlZmF1bHQgdmFsdWUsIHNlcmlh bGl6ZXIsIHBlcm11dGF0aW9uIDIiCj4gK8KgwqDCoCAiZm9vIgo+ICvCoMKgwqAgKGV2YWwtZ2V4 cAo+ICvCoMKgwqDCoCAoc2VyaWFsaXplLWNvbmZpZ3VyYXRpb24gKGNvbmZpZy1zZXIrc2FuKSBj b25maWctc2VyK3Nhbi0KPiBmaWVsZHMpKSkpCj4gKwpBbHNvIGFkZCBhIHRlc3QgY2FzZSBmb3Ig ZG91YmxlIHNlcmlhbGl6ZXIgYW5kIGRvdWJsZSBzYW5pdGl6ZXIgYnVncy4KCkNoZWVycwo= From unknown Fri Jun 20 07:19:24 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#62298] [PATCH 7/8] services: mpd: Use user-account (resp. user-group) for user (resp. group) fields. Resent-From: Bruno Victal Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 21 Mar 2023 02:11:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 62298 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Liliana Marie Prikler Cc: ludo@gnu.org, 62298@debbugs.gnu.org, maxim.cournoyer@gmail.com Received: via spool by 62298-submit@debbugs.gnu.org id=B62298.167936462229180 (code B ref 62298); Tue, 21 Mar 2023 02:11:02 +0000 Received: (at 62298) by debbugs.gnu.org; 21 Mar 2023 02:10:22 +0000 Received: from localhost ([127.0.0.1]:57237 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1peRS9-0007aa-N6 for submit@debbugs.gnu.org; Mon, 20 Mar 2023 22:10:22 -0400 Received: from smtpm3.myservices.hosting ([185.26.105.234]:57230) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1peRS6-0007aM-UV for 62298@debbugs.gnu.org; Mon, 20 Mar 2023 22:10:20 -0400 Received: from mail1.netim.hosting (unknown [185.26.106.173]) by smtpm3.myservices.hosting (Postfix) with ESMTP id 1FD1520D05; Tue, 21 Mar 2023 03:10:16 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by mail1.netim.hosting (Postfix) with ESMTP id 93D438009A; Tue, 21 Mar 2023 03:10:16 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at mail1.netim.hosting Received: from mail1.netim.hosting ([127.0.0.1]) by localhost (mail1-2.netim.hosting [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id wuH8D5qUOdXC; Tue, 21 Mar 2023 03:10:13 +0100 (CET) Received: from [192.168.1.239] (unknown [10.192.1.83]) (Authenticated sender: lumen@makinata.eu) by mail1.netim.hosting (Postfix) with ESMTPSA id 81F0D80098; Tue, 21 Mar 2023 03:10:13 +0100 (CET) Message-ID: Date: Tue, 21 Mar 2023 02:10:05 +0000 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.8.0 Content-Language: en-US References: <6e1da37de3839d56546389924ce47b4563d05d94.1679332019.git.mirai@makinata.eu> <27ddb1989f281cee887c903955cc793fc34bd1ab.camel@gmail.com> From: Bruno Victal In-Reply-To: <27ddb1989f281cee887c903955cc793fc34bd1ab.camel@gmail.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -1.1 (-) 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.1 (--) Hi Liliana, On 2023-03-20 19:33, Liliana Marie Prikler wrote: > Am Montag, dem 20.03.2023 um 17:07 +0000 schrieb Bruno Victal: >> Deprecate using strings for these fields and prefer user-account >> (resp. user-group) instead to avoid duplication within account- >> service-type. If a string value is encountered, it is ignored and a >> predefined variable is used instead. This is essentially a rollback >> to how it used to be before >> '5c5f0fc1135ff15f9c4adfc5f27eadd9a592b5d1'. > I already wrote this in private in IRC, but falling back to a constant > when a string value is given is very silly. IIUC the reason to do so > is because you would need to sanitize the user account and group at the > same time so that the former has access to the latter. > > > I think it's possible to use one of the following approaches to get a > better result: > 1. In (mpd-accounts), check if the user group equals the group name and > raise a warning (or error) if not. > 2. Use a special unique symbol, e.g. (make-symbol "%mpd-group") to > denote the value to be lazily inserted by the serializer. After giving some thought to this, IMO I think it's simply uninteresting for these fields to accept string values. Prior to the 5c5f0fc1135ff15f9c4adfc5f27eadd9a592b5d1 refactor, the names were hardcoded and the refactor allowed them to be changed. But with the observed interactions in [1], it became clear that: 1. This service isn't meant to be used with a non-interactive user, a home shepherd service should be used instead. (granted the bug isn't due to this, it merely surfaced up here. Setting group to “nobody” would have also caused the same kind of problem.) 2. Accepting strings was deemed undesirable since it then results in a “race” between user-accounts from operating-system and account-service-type extensions (or even among the extensions), with the winner getting to “build” the account as it sees fit. In the end, the daemon requires a user-account + user-group to work (unless you're in the mood for running it as root?), so something still has to be made. The choices that I think make sense for user/group fields are: 1. Leave it with a default value. The service creates what it needs. 2. Give it a user-account/group. This is considered an _advanced_ use-case and it's highly likely (though not mandatory) to be used within a let-form. You use this when you need fine control over the account properties. Accepting strings is simply uninteresting (or bad) since: * A string doesn't uniquely identify an account and results in buggy behavior [1]. * Since the string values are only used to set the 'name' of the user-account/group records, which is specific to the service as they're created within the mpd-account procedure, it's simply setting a vanity value. It's as interesting as allowing the filename in (mixed-text-file "mpd.conf" ...) to be set by the user. * It's clearly unsanitizable since it would require accessing other fields. Monkeying within (mpd-accounts) with special symbols just obfuscates the code with no clear benefits to be had, in addition to defeating the point of having a sanitizer in the first place. I fail to see the utility in ever accepting strings here for what amounts to a vanity change in 'ps aux' output. Maybe my imagination is failing here but I really don't think it's worth the trouble to support strings here. This vanity change is still achievable with some extra-typing if someone really wishes it. As such, I think the best course of action is to simply use user-account/group record objects from now on, with string usages deprecated and properly communicated to the user that they're not supported and are ignored. (a non API breaking change) [1]: Cheers, Bruno From unknown Fri Jun 20 07:19:24 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#62298] [PATCH 7/8] services: mpd: Use user-account (resp. user-group) for user (resp. group) fields. Resent-From: Liliana Marie Prikler Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 21 Mar 2023 05:31:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 62298 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Bruno Victal Cc: ludo@gnu.org, 62298@debbugs.gnu.org, maxim.cournoyer@gmail.com Received: via spool by 62298-submit@debbugs.gnu.org id=B62298.167937662017046 (code B ref 62298); Tue, 21 Mar 2023 05:31:01 +0000 Received: (at 62298) by debbugs.gnu.org; 21 Mar 2023 05:30:20 +0000 Received: from localhost ([127.0.0.1]:57386 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1peUZf-0004Qs-M4 for submit@debbugs.gnu.org; Tue, 21 Mar 2023 01:30:19 -0400 Received: from mail-ed1-f66.google.com ([209.85.208.66]:35714) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1peUZe-0004Qf-TV for 62298@debbugs.gnu.org; Tue, 21 Mar 2023 01:30:19 -0400 Received: by mail-ed1-f66.google.com with SMTP id y4so55311017edo.2 for <62298@debbugs.gnu.org>; Mon, 20 Mar 2023 22:30:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679376612; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:from:to:cc:subject :date:message-id:reply-to; bh=AFMwXALYZoh/vMBbC/Gc3+gFWOVMTzCSftiSQ0HT5kQ=; b=Y7QOg0YncocjQqZGPOzeXFBrzqPaoJs7asHMDcVDd0IRcDiz0RjLunh2y/LUHFQdgr n3huIorDr/Kzrcf37XGb+LyVFmWqUASM1B7I9xOS4jjYWzN1c8EhDOJBmbOIRyVFV8y+ el+n4Qd5YmMLu5JnF4viCKATEmickbrPCQwMT9qDj61Uvh/CyPB1CvtgIHIyoiHZxgVE zfkTIZ8k2CDgABtOvbmdgi52URqbLgU+gLD8hRKqfuWhQhccNrfP4is7fbUxumHnU4bU qvdiZsVPsndLG4Z9vnqvZvpJY5V0R1P8f2Z/JyDyDFVMHYaKJROsgANqNhf+cDAkn7ig Vlxg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679376612; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=AFMwXALYZoh/vMBbC/Gc3+gFWOVMTzCSftiSQ0HT5kQ=; b=qcSSe+Xl/TFXH7xqbm6oOa2IbSv4qm+c5VQu2LtFa6t/pVfNSPDIOcofzHxvCVnhQ4 EuYAXgqeacs4kqNCV7UGUAL8EOwZrIcMZYXxV2wChxmhcwnHXQOnbz8QMrRtiTEm/R20 v2Zr2opK927hDt6keu9HAbH4TgUnQ/E81vqvT+UmvTfzGRHNJN3Pwn+dufHI3Xi/e6MN vBGflRH3YJBM9uXL2e2OmoLx4eG5bxvVaetrbnuSSYKz/AvxX/UzzujHKpCL0rdHbWDB DvVP4i6zT6cJgIRNXSvWobsxyG5l6C32i4YsUhn9AbTnSFAmN+YV0XGIrUOHG8V4hLgc ALig== X-Gm-Message-State: AO0yUKUKntBa3UpPCM44V4E67CYOyvXZLVWV0DxJOEzso2m3mHmshY9V qDN3pxaqdkxSykAMIqeOJPM= X-Google-Smtp-Source: AK7set9fzmvJcUmxWf18QSs/OWsmqYS4N5vp+BTKdQNkyL7PFQZxhJEglAOkEuwDrs2PYG+lCfI3EQ== X-Received: by 2002:a17:906:f2d1:b0:92b:ae6c:23e7 with SMTP id gz17-20020a170906f2d100b0092bae6c23e7mr1384824ejb.56.1679376612595; Mon, 20 Mar 2023 22:30:12 -0700 (PDT) Received: from lumine.fritz.box (85-127-52-93.dsl.dynamic.surfer.at. [85.127.52.93]) by smtp.gmail.com with ESMTPSA id g5-20020a170906394500b0092fb818127dsm5321528eje.94.2023.03.20.22.30.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Mar 2023 22:30:12 -0700 (PDT) Message-ID: <32c1e87f3f8bd18e1c18123991ac4dcfebd77b35.camel@gmail.com> From: Liliana Marie Prikler Date: Tue, 21 Mar 2023 06:30:10 +0100 In-Reply-To: References: <6e1da37de3839d56546389924ce47b4563d05d94.1679332019.git.mirai@makinata.eu> <27ddb1989f281cee887c903955cc793fc34bd1ab.camel@gmail.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.46.0 MIME-Version: 1.0 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 (-) Hi Bruno, Am Dienstag, dem 21.03.2023 um 02:10 +0000 schrieb Bruno Victal: > After giving some thought to this, IMO I think it's simply > uninteresting for these fields to accept string values. > Prior to the 5c5f0fc1135ff15f9c4adfc5f27eadd9a592b5d1 refactor, the > names were hardcoded and the refactor allowed them to be changed. I think it's a little late to come to this realization. Note how my prior attempt at fixing 61570 was delayed for more than a month so that a proper sanitizer can be implemented and would have had a better user interface than what you are currently proposing. > Accepting strings is simply uninteresting (or bad) since: >=20 > * A string doesn't uniquely identify an account and results in buggy > behavior [1]. >=20 > * Since the string values are only used to set the 'name' of the > user-account/group records, which is specific to the service as > they're created within the mpd-account procedure, it's simply setting > a vanity value. It's as interesting as allowing the filename in > (mixed-text-file "mpd.conf" ...) to be set by the user. >=20 > * It's clearly unsanitizable since it would require accessing other > fields. Monkeying within (mpd-accounts) with special symbols just > obfuscates the code with no clear benefits to be had, in addition to > defeating the point of having a sanitizer in the first place. >=20 >=20 > I fail to see the utility in ever accepting strings here for what > amounts to a vanity change in 'ps aux' output.=C2=A0 Need I remind you that the original concern was about backwards API compatibility? Yes, accepting strings and doing things with them is broken for the reasons you mentioned and there should be a deprecation warning about this. But not heeding the user values is silly and you should still set those vanity values for the sake of vanity itself. Cheers From unknown Fri Jun 20 07:19:24 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#62298] [PATCH v2 1/8] services: configuration: Add user-defined sanitizer support. References: In-Reply-To: Resent-From: Bruno Victal Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 23 Mar 2023 15:03:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 62298 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 62298@debbugs.gnu.org Cc: ludo@gnu.org, Bruno Victal , liliana.prikler@gmail.com, maxim.cournoyer@gmail.com Received: via spool by 62298-submit@debbugs.gnu.org id=B62298.16795837716291 (code B ref 62298); Thu, 23 Mar 2023 15:03:02 +0000 Received: (at 62298) by debbugs.gnu.org; 23 Mar 2023 15:02:51 +0000 Received: from localhost ([127.0.0.1]:39096 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pfMSd-0001dD-SC for submit@debbugs.gnu.org; Thu, 23 Mar 2023 11:02:51 -0400 Received: from smtpmciv4.myservices.hosting ([185.26.107.240]:35558) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pfMSY-0001d2-Nj for 62298@debbugs.gnu.org; Thu, 23 Mar 2023 11:02:38 -0400 Received: from mail1.netim.hosting (unknown [185.26.106.173]) by smtpmciv4.myservices.hosting (Postfix) with ESMTP id 0355520BEF; Thu, 23 Mar 2023 16:02:31 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by mail1.netim.hosting (Postfix) with ESMTP id 8A0BD800A9; Thu, 23 Mar 2023 16:02:31 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at mail1.netim.hosting Received: from mail1.netim.hosting ([127.0.0.1]) by localhost (mail1-2.netim.hosting [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id cUhRYvE0fmJD; Thu, 23 Mar 2023 16:02:29 +0100 (CET) Received: from guix-nuc.home.arpa (bl9-119-177.dsl.telepac.pt [85.242.119.177]) (Authenticated sender: lumen@makinata.eu) by mail1.netim.hosting (Postfix) with ESMTPSA id 38DE3800A8; Thu, 23 Mar 2023 16:02:29 +0100 (CET) From: Bruno Victal Date: Thu, 23 Mar 2023 15:02:11 +0000 Message-Id: X-Mailer: git-send-email 2.39.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 (-) This changes the 'custom-serializer' field into a generic 'extra-args' field that can be extended to support new literals. With this mechanism, the literals 'sanitizer' allow for user-defined sanitizer procedures while the 'serializer' literal is used for custom serializer procedures. The 'empty-serializer' was also added as a 'literal' and can be used just like it was previously. With the repurposing of 'custom-serializer' into 'extra-args', to prevent intolerable confusion, the custom serializer procedures should be specified using the new 'literals' approach, with the previous “style” being considered deprecated. * gnu/services/configuration.scm (define-configuration-helper): Rename 'custom-serializer' to 'extra-args'. Add support for literals 'sanitizer', 'serializer' and 'empty-serializer'. Rename procedure 'field-sanitizer' to 'default-field-sanitizer' to avoid syntax clash. Only define default field sanitizers if user-defined ones are absent. (normalize-extra-args): New procedure. ()[sanitizer]: New field. * doc/guix.texi (Complex Configurations): Document the newly added literals. * tests/services/configuration.scm: Add tests for the new literals. --- doc/guix.texi | 30 ++++- gnu/services/configuration.scm | 91 +++++++++++---- tests/services/configuration.scm | 185 ++++++++++++++++++++++++++++++- 3 files changed, 280 insertions(+), 26 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index dfdb26103a..1609e508ef 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -41216,7 +41216,7 @@ Complex Configurations (@var{field-name} (@var{type} @var{default-value}) @var{documentation} - @var{serializer}) + (serializer @var{serializer})) (@var{field-name} (@var{type}) @@ -41225,7 +41225,18 @@ Complex Configurations (@var{field-name} (@var{type}) @var{documentation} - @var{serializer}) + (serializer @var{serializer})) + +(@var{field-name} + (@var{type}) + @var{documentation} + (sanitizer @var{sanitizer}) + +(@var{field-name} + (@var{type}) + @var{documentation} + (sanitizer @var{sanitizer}) + (serializer @var{serializer})) @end example @var{field-name} is an identifier that denotes the name of the field in @@ -41248,6 +41259,21 @@ Complex Configurations @var{documentation} is a string formatted with Texinfo syntax which should provide a description of what setting this field does. +@var{sanitizer} is the name of a procedure which takes one argument, +a user-supplied value, and returns a ``sanitized'' value for the field. +If none is specified, the predicate @code{@var{type}?} is automatically +used to construct an internal sanitizer that asserts the type correctness +of the field value. + +An example of a sanitizer for a field that accepts both strings and +symbols looks like this: +@lisp +(define (sanitize-foo value) + (cond ((string? value) value) + ((symbol? value) (symbol->string value)) + (else (throw 'bad! value)))) +@end lisp + @var{serializer} is the name of a procedure which takes two arguments, the first is the name of the field, and the second is the value corresponding to the field. The procedure should return a string or diff --git a/gnu/services/configuration.scm b/gnu/services/configuration.scm index 174c2f20d2..409d4cef00 100644 --- a/gnu/services/configuration.scm +++ b/gnu/services/configuration.scm @@ -6,6 +6,7 @@ ;;; Copyright © 2021, 2022 Maxim Cournoyer ;;; Copyright © 2021 Andrew Tropin ;;; Copyright © 2022 Maxime Devos +;;; Copyright © 2023 Bruno Victal ;;; ;;; This file is part of GNU Guix. ;;; @@ -28,7 +29,8 @@ (define-module (gnu services configuration) #:use-module (guix gexp) #:use-module ((guix utils) #:select (source-properties->location)) #:use-module ((guix diagnostics) - #:select (formatted-message location-file &error-location)) + #:select (formatted-message location-file &error-location + warning)) #:use-module ((guix modules) #:select (file-name->module-name)) #:use-module (guix i18n) #:autoload (texinfo) (texi-fragment->stexi) @@ -37,6 +39,7 @@ (define-module (gnu services configuration) #:use-module (ice-9 format) #:use-module (ice-9 match) #:use-module (srfi srfi-1) + #:use-module (srfi srfi-26) #:use-module (srfi srfi-34) #:use-module (srfi srfi-35) #:export (configuration-field @@ -44,6 +47,7 @@ (define-module (gnu services configuration) configuration-field-type configuration-missing-field configuration-field-error + configuration-field-sanitizer configuration-field-serializer configuration-field-getter configuration-field-default-value-thunk @@ -116,6 +120,7 @@ (define-record-type* (type configuration-field-type) (getter configuration-field-getter) (predicate configuration-field-predicate) + (sanitizer configuration-field-sanitizer) (serializer configuration-field-serializer) (default-value-thunk configuration-field-default-value-thunk) (documentation configuration-field-documentation)) @@ -181,11 +186,45 @@ (define (normalize-field-type+def s) (values #'(field-type %unset-value))))) (define (define-configuration-helper serialize? serializer-prefix syn) + + (define (normalize-extra-args s) + (let loop ((s s) + (sanitizer* %unset-value) + (serializer* %unset-value)) + (syntax-case s (sanitizer serializer empty-serializer) + (((sanitizer proc) tail ...) + (if (maybe-value-set? sanitizer*) + (syntax-violation 'sanitizer "duplicate entry" + #'proc) + (loop #'(tail ...) #'proc serializer*))) + (((serializer proc) tail ...) + (if (maybe-value-set? serializer*) + (syntax-violation 'serializer "duplicate or conflicting entry" + #'proc) + (loop #'(tail ...) sanitizer* #'proc))) + ((empty-serializer tail ...) + (if (maybe-value-set? serializer*) + (syntax-violation 'empty-serializer + "duplicate or conflicting entry" #f) + (loop #'(tail ...) sanitizer* #'empty-serializer))) + (() ; stop condition + (values (list sanitizer* serializer*))) + ((proc) ; TODO: deprecated, to be removed + (every (cut eq? <> #f) + (map maybe-value-set? + (list sanitizer* serializer*))) + (begin + (warning #f (G_ "specifying serializers after documentation is \ +deprecated, use (serializer ~a) instead~%") (syntax->datum #'proc)) + (values (list %unset-value #'proc))))))) + (syntax-case syn () - ((_ stem (field field-type+def doc custom-serializer ...) ...) + ((_ stem (field field-type+def doc extra-args ...) ...) (with-syntax ((((field-type def) ...) - (map normalize-field-type+def #'(field-type+def ...)))) + (map normalize-field-type+def #'(field-type+def ...))) + (((sanitizer* serializer*) ...) + (map normalize-extra-args #'((extra-args ...) ...)))) (with-syntax (((field-getter ...) (map (lambda (field) @@ -200,21 +239,18 @@ (define (define-configuration-helper serialize? serializer-prefix syn) ((field-type default-value) default-value)) #'((field-type def) ...))) + ((field-sanitizer ...) + (map maybe-value #'(sanitizer* ...))) ((field-serializer ...) - (map (lambda (type custom-serializer) + (map (lambda (type proc) (and serialize? - (match custom-serializer - ((serializer) - serializer) - (() - (if serializer-prefix - (id #'stem - serializer-prefix - #'serialize- type) - (id #'stem #'serialize- type)))))) + (or (maybe-value proc) + (if serializer-prefix + (id #'stem serializer-prefix #'serialize- type) + (id #'stem #'serialize- type))))) #'(field-type ...) - #'((custom-serializer ...) ...)))) - (define (field-sanitizer name pred) + #'(serializer* ...)))) + (define (default-field-sanitizer name pred) ;; Define a macro for use as a record field sanitizer, where NAME ;; is the name of the field and PRED is the predicate that tells ;; whether a value is valid for this field. @@ -235,21 +271,29 @@ (define (define-configuration-helper serialize? serializer-prefix syn) #`(begin ;; Define field validation macros. - #,@(map field-sanitizer - #'(field ...) - #'(field-predicate ...)) + #,@(filter-map (lambda (name pred sanitizer) + (if sanitizer + #f + (default-field-sanitizer name pred))) + #'(field ...) + #'(field-predicate ...) + #'(field-sanitizer ...)) (define-record-type* #,(id #'stem #'< #'stem #'>) stem #,(id #'stem #'make- #'stem) #,(id #'stem #'stem #'?) - #,@(map (lambda (name getter def) - #`(#,name #,getter (default #,def) + #,@(map (lambda (name getter def sanitizer) + #`(#,name #,getter + (default #,def) (sanitize - #,(id #'stem #'validate- #'stem #'- name)))) + #,(or sanitizer + (id #'stem + #'validate- #'stem #'- name))))) #'(field ...) #'(field-getter ...) - #'(field-default ...)) + #'(field-default ...) + #'(field-sanitizer ...)) (%location #,(id #'stem #'stem #'-source-location) (default (and=> (current-source-location) source-properties->location)) @@ -261,6 +305,9 @@ (define (define-configuration-helper serialize? serializer-prefix syn) (type 'field-type) (getter field-getter) (predicate field-predicate) + (sanitizer + (or field-sanitizer + (id #'stem #'validate- #'stem #'- #'field))) (serializer field-serializer) (default-value-thunk (lambda () diff --git a/tests/services/configuration.scm b/tests/services/configuration.scm index 4f8a74dc8a..64b7bb1543 100644 --- a/tests/services/configuration.scm +++ b/tests/services/configuration.scm @@ -2,6 +2,7 @@ ;;; Copyright © 2021, 2022 Maxim Cournoyer ;;; Copyright © 2021 Xinglu Chen ;;; Copyright © 2022 Ludovic Courtès +;;; Copyright © 2023 Bruno Victal ;;; ;;; This file is part of GNU Guix. ;;; @@ -22,6 +23,7 @@ (define-module (tests services configuration) #:use-module (gnu services configuration) #:use-module (guix diagnostics) #:use-module (guix gexp) + #:autoload (guix i18n) (G_) #:use-module (srfi srfi-34) #:use-module (srfi srfi-64)) @@ -46,14 +48,14 @@ (define-configuration port-configuration (port-configuration-port (port-configuration))) (test-equal "wrong type for a field" - '("configuration.scm" 57 11) ;error location + '("configuration.scm" 59 11) ;error location (guard (c ((configuration-error? c) (let ((loc (error-location c))) (list (basename (location-file loc)) (location-line loc) (location-column loc))))) (port-configuration - ;; This is line 56; the test relies on line/column numbers! + ;; This is line 58; the test relies on line/column numbers! (port "This is not a number!")))) (define-configuration port-configuration-cs @@ -109,6 +111,185 @@ (define-configuration configuration-with-prefix (let ((config (configuration-with-prefix))) (serialize-configuration config configuration-with-prefix-fields)))) + +;;; +;;; define-configuration macro, extra-args literals +;;; + +(define (eval-gexp x) + "Get serialized config as string." + (eval (gexp->approximate-sexp x) + (current-module))) + +(define (port? value) + (or (string? value) (number? value))) + +(define (sanitize-port value) + (cond ((number? value) value) + ((string? value) (string->number value)) + (else (raise (formatted-message (G_ "Bad value: ~a") value))))) + +(test-group "Basic sanitizer literal tests" + (define serialize-port serialize-number) + + (define-configuration config-with-sanitizer + (port + (port 80) + "Lorem Ipsum." + (sanitizer sanitize-port))) + + (test-equal "default value, sanitizer" + 80 + (config-with-sanitizer-port (config-with-sanitizer))) + + (test-equal "string value, sanitized to number" + 56 + (config-with-sanitizer-port (config-with-sanitizer + (port "56")))) + + (define (custom-serialize-port field-name value) + (number->string value)) + + (define-configuration config-serializer + (port + (port 80) + "Lorem Ipsum." + (serializer custom-serialize-port))) + + (test-equal "default value, serializer literal" + "80" + (eval-gexp + (serialize-configuration (config-serializer) + config-serializer-fields)))) + +(test-group "empty-serializer as literal/procedure tests" + ;; empty-serializer as literal + (define-configuration config-with-literal + (port + (port 80) + "Lorem Ipsum." + empty-serializer)) + + ;; empty-serializer as procedure + (define-configuration config-with-proc + (port + (port 80) + "Lorem Ipsum." + (serializer empty-serializer))) + + (test-equal "empty-serializer as literal" + "" + (eval-gexp + (serialize-configuration (config-with-literal) + config-with-literal-fields))) + + (test-equal "empty-serializer as procedure" + "" + (eval-gexp + (serialize-configuration (config-with-proc) + config-with-proc-fields)))) + +(test-group "permutation tests" + (define-configuration config-san+empty-ser + (port + (port 80) + "Lorem Ipsum." + (sanitizer sanitize-port) + empty-serializer)) + + (define-configuration config-san+ser + (port + (port 80) + "Lorem Ipsum." + (sanitizer sanitize-port) + (serializer (lambda _ "foo")))) + + (test-equal "default value, sanitizer, permutation" + 80 + (config-san+empty-ser-port (config-san+empty-ser))) + + (test-equal "default value, serializer, permutation" + "foo" + (eval-gexp + (serialize-configuration (config-san+ser) config-san+ser-fields))) + + (test-equal "string value sanitized to number, permutation" + 56 + (config-san+ser-port (config-san+ser + (port "56")))) + + ;; ordering tests + (define-configuration config-ser+san + (port + (port 80) + "Lorem Ipsum." + (sanitizer sanitize-port) + (serializer (lambda _ "foo")))) + + (define-configuration config-empty-ser+san + (port + (port 80) + "Lorem Ipsum." + empty-serializer + (sanitizer sanitize-port))) + + (test-equal "default value, sanitizer, permutation 2" + 56 + (config-empty-ser+san-port (config-empty-ser+san + (port "56")))) + + (test-equal "default value, serializer, permutation 2" + "foo" + (eval-gexp + (serialize-configuration (config-ser+san) config-ser+san-fields)))) + +(test-group "duplicated/conflicting entries" + (test-error + "duplicate sanitizer" #t + (macroexpand '(define-configuration dupe-san + (foo + (list '()) + "Lorem Ipsum." + (sanitizer (lambda () #t)) + (sanitizer (lambda () #t)))))) + + (test-error + "duplicate serializer" #t + (macroexpand '(define-configuration dupe-ser + (foo + (list '()) + "Lorem Ipsum." + (serializer (lambda _ "")) + (serializer (lambda _ "")))))) + + (test-error + "conflicting use of serializer + empty-serializer" #t + (macroexpand '(define-configuration ser+empty-ser + (foo + (list '()) + "Lorem Ipsum." + (serializer (lambda _ "lorem")) + empty-serializer))))) + +(test-group "Mix of deprecated and new syntax" + (test-error + "Mix of bare serializer and new syntax" #t + (macroexpand '(define-configuration mixed + (foo + (list '()) + "Lorem Ipsum." + (sanitizer (lambda () #t)) + (lambda _ "lorem"))))) + + (test-error + "Mix of bare serializer and new syntax, permutation)" #t + (macroexpand '(define-configuration mixed + (foo + (list '()) + "Lorem Ipsum." + (lambda _ "lorem") + (sanitizer (lambda () #t))))))) + ;;; ;;; define-maybe macro. -- 2.39.1 From unknown Fri Jun 20 07:19:24 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#62298] [PATCH v2 2/8] services: replace bare serializers with (serializer ...) Resent-From: Bruno Victal Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 23 Mar 2023 15:05:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 62298 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 62298@debbugs.gnu.org Cc: ludo@gnu.org, Bruno Victal , liliana.prikler@gmail.com, maxim.cournoyer@gmail.com Received: via spool by 62298-submit@debbugs.gnu.org id=B62298.16795838586461 (code B ref 62298); Thu, 23 Mar 2023 15:05:02 +0000 Received: (at 62298) by debbugs.gnu.org; 23 Mar 2023 15:04:18 +0000 Received: from localhost ([127.0.0.1]:39102 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pfMU9-0001fp-TJ for submit@debbugs.gnu.org; Thu, 23 Mar 2023 11:04:17 -0400 Received: from smtpmciv2.myservices.hosting ([185.26.107.238]:48980) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pfMU4-0001fa-KR for 62298@debbugs.gnu.org; Thu, 23 Mar 2023 11:04:13 -0400 Received: from mail1.netim.hosting (unknown [185.26.106.173]) by smtpmciv2.myservices.hosting (Postfix) with ESMTP id 3449B20D6B; Thu, 23 Mar 2023 16:04:06 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by mail1.netim.hosting (Postfix) with ESMTP id C85E0800AD; Thu, 23 Mar 2023 16:04:06 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at mail1.netim.hosting Received: from mail1.netim.hosting ([127.0.0.1]) by localhost (mail1-2.netim.hosting [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id cgueMhxCQalA; Thu, 23 Mar 2023 16:04:06 +0100 (CET) Received: from guix-nuc.home.arpa (bl9-119-177.dsl.telepac.pt [85.242.119.177]) (Authenticated sender: lumen@makinata.eu) by mail1.netim.hosting (Postfix) with ESMTPSA id D0DCD800AB; Thu, 23 Mar 2023 16:04:05 +0100 (CET) From: Bruno Victal Date: Thu, 23 Mar 2023 15:02:12 +0000 Message-Id: X-Mailer: git-send-email 2.39.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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/home/services/shells.scm (home-zsh-configuration)[environment-variables]: Use (serializer ...). (home-bash-configuration)[aliases, environment-variables]: Ditto. (home-fish-configuration)[abbreviations, aliases, environment-variables]: Ditto. * gnu/services/audio.scm (mpd-configuration)[music-dir, playlist-dir, endpoints] [address, inputs, archive-plugins, input-cache-size, decoders, filters, playlist-plugins]: Ditto. * gnu/services/linux.scm (fstrim-configuration)[extra-arguments]: Ditto. * gnu/services/security.scm (fail2ban-jail-configuration)[backend, log-encoding, extra-content]: Ditto. * tests/services/configuration.scm: Update tests. Add test for deprecated bare serializers. --- gnu/home/services/shells.scm | 12 ++++----- gnu/services/audio.scm | 44 ++++++++++++++++---------------- gnu/services/linux.scm | 7 ++--- gnu/services/security.scm | 6 ++--- tests/services/configuration.scm | 11 +++++++- 5 files changed, 45 insertions(+), 35 deletions(-) diff --git a/gnu/home/services/shells.scm b/gnu/home/services/shells.scm index 3326eb37f4..f05f2221d6 100644 --- a/gnu/home/services/shells.scm +++ b/gnu/home/services/shells.scm @@ -133,7 +133,7 @@ (define-configuration home-zsh-configuration (environment-variables (alist '()) "Association list of environment variables to set for the Zsh session." - serialize-posix-env-vars) + (serializer serialize-posix-env-vars)) (zshenv (text-config '()) "List of file-like objects, which will be added to @file{.zshenv}. @@ -334,7 +334,7 @@ (define-configuration home-bash-configuration rules for the @code{home-environment-variables-service-type} apply here (@pxref{Essential Home Services}). The contents of this field will be added after the contents of the @code{bash-profile} field." - serialize-posix-env-vars) + (serializer serialize-posix-env-vars)) (aliases (alist '()) "Association list of aliases to set for the Bash session. The aliases will be @@ -351,7 +351,7 @@ (define-configuration home-bash-configuration @example alias ls=\"ls -alF\" @end example" - bash-serialize-aliases) + (serializer bash-serialize-aliases)) (bash-profile (text-config '()) "List of file-like objects, which will be added to @file{.bash_profile}. @@ -536,19 +536,19 @@ (define-configuration home-fish-configuration (environment-variables (alist '()) "Association list of environment variables to set in Fish." - serialize-fish-env-vars) + (serializer serialize-fish-env-vars)) (aliases (alist '()) "Association list of aliases for Fish, both the key and the value should be a string. An alias is just a simple function that wraps a command, If you want something more akin to @dfn{aliases} in POSIX shells, see the @code{abbreviations} field." - serialize-fish-aliases) + (serializer serialize-fish-aliases)) (abbreviations (alist '()) "Association list of abbreviations for Fish. These are words that, when typed in the shell, will automatically expand to the full text." - serialize-fish-abbreviations)) + (serializer serialize-fish-abbreviations))) (define (fish-files-service config) `(("fish/config.fish" diff --git a/gnu/services/audio.scm b/gnu/services/audio.scm index d55b804ba9..5f341fac0f 100644 --- a/gnu/services/audio.scm +++ b/gnu/services/audio.scm @@ -372,7 +372,7 @@ (define-configuration mpd-configuration (music-dir ; TODO: deprecated, remove later maybe-string "The directory to scan for music files." - mpd-serialize-deprecated-field) + (serializer mpd-serialize-deprecated-field)) (playlist-directory maybe-string @@ -381,7 +381,7 @@ (define-configuration mpd-configuration (playlist-dir ; TODO: deprecated, remove later maybe-string "The directory to store playlists." - mpd-serialize-deprecated-field) + (serializer mpd-serialize-deprecated-field)) (db-file maybe-string @@ -407,16 +407,16 @@ (define-configuration mpd-configuration port is used. To use a Unix domain socket, an absolute path or a path starting with @code{~} can be specified here." - (lambda (_ endpoints) - (if (maybe-value-set? endpoints) - (mpd-serialize-list-of-string "bind_to_address" endpoints) - ""))) + (serializer (lambda (_ endpoints) + (if (maybe-value-set? endpoints) + (mpd-serialize-list-of-string "bind_to_address" endpoints) + "")))) (address ; TODO: deprecated, remove later maybe-string "The address that mpd will bind to. To use a Unix domain socket, an absolute path can be specified here." - mpd-serialize-deprecated-field) + (serializer mpd-serialize-deprecated-field)) (database maybe-mpd-plugin @@ -433,29 +433,29 @@ (define-configuration mpd-configuration (inputs (list-of-mpd-plugin '()) "List of MPD input plugin configurations." - (lambda (_ x) - (mpd-serialize-list-of-mpd-plugin "input" x))) + (serializer (lambda (_ x) + (mpd-serialize-list-of-mpd-plugin "input" x)))) (archive-plugins (list-of-mpd-plugin '()) "List of MPD archive plugin configurations." - (lambda (_ x) - (mpd-serialize-list-of-mpd-plugin "archive_plugin" x))) + (serializer (lambda (_ x) + (mpd-serialize-list-of-mpd-plugin "archive_plugin" x)))) (input-cache-size maybe-string "MPD input cache size." - (lambda (_ x) - (if (maybe-value-set? x) - #~(string-append "\ninput_cache {\n" - #$(mpd-serialize-string "size" x) - "}\n") ""))) + (serializer (lambda (_ x) + (if (maybe-value-set? x) + #~(string-append "\ninput_cache {\n" + #$(mpd-serialize-string "size" x) + "}\n") "")))) (decoders (list-of-mpd-plugin '()) "List of MPD decoder plugin configurations." - (lambda (_ x) - (mpd-serialize-list-of-mpd-plugin "decoder" x))) + (serializer (lambda (_ x) + (mpd-serialize-list-of-mpd-plugin "decoder" x)))) (resampler maybe-mpd-plugin @@ -464,8 +464,8 @@ (define-configuration mpd-configuration (filters (list-of-mpd-plugin '()) "List of MPD filter plugin configurations." - (lambda (_ x) - (mpd-serialize-list-of-mpd-plugin "filter" x))) + (serializer (lambda (_ x) + (mpd-serialize-list-of-mpd-plugin "filter" x)))) (outputs (list-of-mpd-plugin-or-output (list (mpd-output))) @@ -475,8 +475,8 @@ (define-configuration mpd-configuration (playlist-plugins (list-of-mpd-plugin '()) "List of MPD playlist plugin configurations." - (lambda (_ x) - (mpd-serialize-list-of-mpd-plugin "playlist_plugin" x))) + (serializer (lambda (_ x) + (mpd-serialize-list-of-mpd-plugin "playlist_plugin" x)))) (extra-options (alist '()) diff --git a/gnu/services/linux.scm b/gnu/services/linux.scm index d085b375a2..229220eeb1 100644 --- a/gnu/services/linux.scm +++ b/gnu/services/linux.scm @@ -213,9 +213,10 @@ (define-configuration fstrim-configuration maybe-list-of-strings "Extra options to append to @command{fstrim} (run @samp{man fstrim} for more information)." - (lambda (_ value) - (if (maybe-value-set? value) - value '()))) + (serializer + (lambda (_ value) + (if (maybe-value-set? value) + value '())))) (prefix fstrim-)) (define (serialize-fstrim-configuration config) diff --git a/gnu/services/security.scm b/gnu/services/security.scm index 8116072920..e750bb468b 100644 --- a/gnu/services/security.scm +++ b/gnu/services/security.scm @@ -200,7 +200,7 @@ (define-configuration fail2ban-jail-configuration "Backend to use to detect changes in the @code{log-path}. The default is 'auto. To consult the defaults of the jail configuration, refer to the @file{/etc/fail2ban/jail.conf} file of the @code{fail2ban} package." - fail2ban-jail-configuration-serialize-backend) + (serializer fail2ban-jail-configuration-serialize-backend)) (max-retry maybe-integer "The number of failures before a host get banned @@ -269,7 +269,7 @@ (define-configuration fail2ban-jail-configuration maybe-symbol "The encoding of the log files handled by the jail. Possible values are: @code{'ascii}, @code{'utf-8} and @code{'auto}." - fail2ban-jail-configuration-serialize-log-encoding) + (serializer fail2ban-jail-configuration-serialize-log-encoding)) (log-path (list-of-strings '()) "The file names of the log files to be monitored.") @@ -280,7 +280,7 @@ (define-configuration fail2ban-jail-configuration (text-config '()) "Extra content for the jail configuration, provided as a list of file-like objects." - serialize-text-config) + (serializer serialize-text-config)) (prefix fail2ban-jail-configuration-)) (define list-of-fail2ban-jail-configurations? diff --git a/tests/services/configuration.scm b/tests/services/configuration.scm index 64b7bb1543..20952acb79 100644 --- a/tests/services/configuration.scm +++ b/tests/services/configuration.scm @@ -82,6 +82,9 @@ (define (custom-number-serializer name value) (format #f "~a = ~a;" name value)) (define-configuration serializable-configuration + (port (number 80) "The port number." (serializer custom-number-serializer))) + +(define-configuration serializable-configuration-deprecated (port (number 80) "The port number." custom-number-serializer)) (test-assert "serialize-configuration" @@ -89,8 +92,14 @@ (define-configuration serializable-configuration (let ((config (serializable-configuration))) (serialize-configuration config serializable-configuration-fields)))) +(test-assert "serialize-configuration [deprecated]" + (gexp? + (let ((config (serializable-configuration-deprecated))) + (serialize-configuration + config serializable-configuration-deprecated-fields)))) + (define-configuration serializable-configuration - (port (number 80) "The port number." custom-number-serializer) + (port (number 80) "The port number." (serializer custom-number-serializer)) (no-serialization)) (test-assert "serialize-configuration with no-serialization" -- 2.39.1 From unknown Fri Jun 20 07:19:24 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#62298] [PATCH v2 4/8] services: mympd: Require 'syslog service when configured to log to syslog. Resent-From: Bruno Victal Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 23 Mar 2023 15:05:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 62298 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 62298@debbugs.gnu.org Cc: ludo@gnu.org, Bruno Victal , liliana.prikler@gmail.com, maxim.cournoyer@gmail.com Received: via spool by 62298-submit@debbugs.gnu.org id=B62298.16795838586468 (code B ref 62298); Thu, 23 Mar 2023 15:05:02 +0000 Received: (at 62298) by debbugs.gnu.org; 23 Mar 2023 15:04:18 +0000 Received: from localhost ([127.0.0.1]:39105 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pfMUD-0001gA-SL for submit@debbugs.gnu.org; Thu, 23 Mar 2023 11:04:18 -0400 Received: from smtpm5.myservices.hosting ([185.26.105.236]:53864) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pfMU5-0001fc-JV for 62298@debbugs.gnu.org; Thu, 23 Mar 2023 11:04:13 -0400 Received: from mail1.netim.hosting (unknown [185.26.106.173]) by smtpm5.myservices.hosting (Postfix) with ESMTP id D732C20C8E; Thu, 23 Mar 2023 16:04:07 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by mail1.netim.hosting (Postfix) with ESMTP id 740C1800AF; Thu, 23 Mar 2023 16:04:07 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at mail1.netim.hosting Received: from mail1.netim.hosting ([127.0.0.1]) by localhost (mail1-2.netim.hosting [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id KoGW-VpicUiH; Thu, 23 Mar 2023 16:04:07 +0100 (CET) Received: from guix-nuc.home.arpa (bl9-119-177.dsl.telepac.pt [85.242.119.177]) (Authenticated sender: lumen@makinata.eu) by mail1.netim.hosting (Postfix) with ESMTPSA id D8E46800AB; Thu, 23 Mar 2023 16:04:06 +0100 (CET) From: Bruno Victal Date: Thu, 23 Mar 2023 15:02:14 +0000 Message-Id: <96e6404d84211c766924d2fcd4f88d33c11cacfe.1679583701.git.mirai@makinata.eu> X-Mailer: git-send-email 2.39.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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/audio.scm (mympd-shepherd-service): Depend on 'syslog when configured to log to syslog. --- gnu/services/audio.scm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gnu/services/audio.scm b/gnu/services/audio.scm index e9ecccd614..e5b065a479 100644 --- a/gnu/services/audio.scm +++ b/gnu/services/audio.scm @@ -749,7 +749,9 @@ (define (mympd-shepherd-service config) (let ((log-level* (format #f "MYMPD_LOGLEVEL=~a" log-level))) (shepherd-service (documentation "Run the myMPD daemon.") - (requirement `(loopback user-processes ,@shepherd-requirement)) + (requirement `(loopback user-processes + ,@(if (eqv? log-to 'syslog) '(syslog) '()) + ,@shepherd-requirement)) (provision '(mympd)) (start #~(begin (let* ((pw (getpwnam #$user)) -- 2.39.1 From unknown Fri Jun 20 07:19:24 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#62298] [PATCH v2 3/8] services: audio: remove redundant list-of-string? predicate. Resent-From: Bruno Victal Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 23 Mar 2023 15:05:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 62298 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 62298@debbugs.gnu.org Cc: ludo@gnu.org, Bruno Victal , liliana.prikler@gmail.com, maxim.cournoyer@gmail.com Received: via spool by 62298-submit@debbugs.gnu.org id=B62298.16795838626487 (code B ref 62298); Thu, 23 Mar 2023 15:05:03 +0000 Received: (at 62298) by debbugs.gnu.org; 23 Mar 2023 15:04:22 +0000 Received: from localhost ([127.0.0.1]:39108 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pfMUI-0001gX-5e for submit@debbugs.gnu.org; Thu, 23 Mar 2023 11:04:22 -0400 Received: from smtpmciv4.myservices.hosting ([185.26.107.240]:35874) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pfMU6-0001fe-CJ for 62298@debbugs.gnu.org; Thu, 23 Mar 2023 11:04:16 -0400 Received: from mail1.netim.hosting (unknown [185.26.106.173]) by smtpmciv4.myservices.hosting (Postfix) with ESMTP id 38F2720BEF; Thu, 23 Mar 2023 16:04:09 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by mail1.netim.hosting (Postfix) with ESMTP id D8735800AB; Thu, 23 Mar 2023 16:04:08 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at mail1.netim.hosting Received: from mail1.netim.hosting ([127.0.0.1]) by localhost (mail1-2.netim.hosting [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id MAuhfZRb5ihg; Thu, 23 Mar 2023 16:04:06 +0100 (CET) Received: from guix-nuc.home.arpa (bl9-119-177.dsl.telepac.pt [85.242.119.177]) (Authenticated sender: lumen@makinata.eu) by mail1.netim.hosting (Postfix) with ESMTPSA id 5689A800AC; Thu, 23 Mar 2023 16:04:06 +0100 (CET) From: Bruno Victal Date: Thu, 23 Mar 2023 15:02:13 +0000 Message-Id: X-Mailer: git-send-email 2.39.1 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 (-) Use list-of-strings? predicate defined in (gnu services configuration). * gnu/services/audio.scm (list-of-string?): Remove predicate. (mpd-serialize-list-of-string): Rename procedure to ... (mpd-serialize-list-of-strings): ... this. (mpd-configuration)[environment-variables]: Switch to list-of-strings. [endpoints]: Switch to maybe-list-of-strings. (mympd-ip-acl)[allow, deny]: Switch to list-of-strings. (mympd-serialize-configuration): Rename serialize-list-of-string to serialize-list-of-strings. * doc/guix.texi (Audio Services): Update it. --- doc/guix.texi | 8 ++++---- gnu/services/audio.scm | 25 +++++++++++-------------- 2 files changed, 15 insertions(+), 18 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index 1609e508ef..2b62605b51 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -33501,7 +33501,7 @@ Audio Services This is a list of symbols naming Shepherd services that this service will depend on. -@item @code{environment-variables} (default: @code{()}) (type: list-of-string) +@item @code{environment-variables} (default: @code{()}) (type: list-of-strings) A list of strings specifying environment variables. @item @code{log-file} (default: @code{"/var/log/mpd/log"}) (type: maybe-string) @@ -33532,7 +33532,7 @@ Audio Services @item @code{default-port} (default: @code{6600}) (type: maybe-integer) The default port to run mpd on. -@item @code{endpoints} (type: maybe-list-of-string) +@item @code{endpoints} (type: maybe-list-of-strings) The addresses that mpd will bind to. A port different from @var{default-port} may be specified, e.g. @code{localhost:6602} and IPv6 addresses must be enclosed in square brackets when a different port is used. @@ -33808,10 +33808,10 @@ Audio Services Available @code{mympd-ip-acl} fields are: @table @asis -@item @code{allow} (default: @code{()}) (type: list-of-string) +@item @code{allow} (default: @code{()}) (type: list-of-strings) Allowed IP addresses. -@item @code{deny} (default: @code{()}) (type: list-of-string) +@item @code{deny} (default: @code{()}) (type: list-of-strings) Disallowed IP addresses. @end table diff --git a/gnu/services/audio.scm b/gnu/services/audio.scm index 5f341fac0f..e9ecccd614 100644 --- a/gnu/services/audio.scm +++ b/gnu/services/audio.scm @@ -2,7 +2,7 @@ ;;; Copyright © 2017 Peter Mikkelsen ;;; Copyright © 2019 Ricardo Wurmus ;;; Copyright © 2020 Ludovic Courtès -;;; Copyright © 2022 Bruno Victal +;;; Copyright © 2022⁠–⁠2023 Bruno Victal ;;; ;;; This file is part of GNU Guix. ;;; @@ -137,9 +137,6 @@ (define (uglify-field-name field-name) str) #\-) "_"))) -(define list-of-string? - (list-of string?)) - (define list-of-symbol? (list-of symbol?)) @@ -159,11 +156,11 @@ (define (mpd-serialize-alist field-name value) (define mpd-serialize-string mpd-serialize-field) (define mpd-serialize-boolean mpd-serialize-field) -(define (mpd-serialize-list-of-string field-name value) +(define (mpd-serialize-list-of-strings field-name value) #~(string-append #$@(map (cut mpd-serialize-string field-name <>) value))) (define-maybe string (prefix mpd-)) -(define-maybe list-of-string (prefix mpd-)) +(define-maybe list-of-strings (prefix mpd-)) (define-maybe boolean (prefix mpd-)) ;;; TODO: Procedures for deprecated fields, to be removed. @@ -349,7 +346,7 @@ (define-configuration mpd-configuration empty-serializer) (environment-variables - (list-of-string '()) + (list-of-strings '()) "A list of strings specifying environment variables." empty-serializer) @@ -400,7 +397,7 @@ (define-configuration mpd-configuration "The default port to run mpd on.") (endpoints - maybe-list-of-string + maybe-list-of-strings "The addresses that mpd will bind to. A port different from @var{default-port} may be specified, e.g. @code{localhost:6602} and IPv6 addresses must be enclosed in square brackets when a different @@ -409,7 +406,7 @@ (define-configuration mpd-configuration can be specified here." (serializer (lambda (_ endpoints) (if (maybe-value-set? endpoints) - (mpd-serialize-list-of-string "bind_to_address" endpoints) + (mpd-serialize-list-of-strings "bind_to_address" endpoints) "")))) (address ; TODO: deprecated, remove later @@ -581,11 +578,11 @@ (define (string-or-symbol? x) (define-configuration/no-serialization mympd-ip-acl (allow - (list-of-string '()) + (list-of-strings '()) "Allowed IP addresses.") (deny - (list-of-string '()) + (list-of-strings '()) "Disallowed IP addresses.")) (define-maybe/no-serialization integer) @@ -707,12 +704,12 @@ (define (mympd-serialize-configuration config) ((? string? val) val))) (define (ip-acl-serialize-configuration config) - (define (serialize-list-of-string prefix lst) + (define (serialize-list-of-strings prefix lst) (map (cut format #f "~a~a" prefix <>) lst)) (string-join (append - (serialize-list-of-string "+" (mympd-ip-acl-allow config)) - (serialize-list-of-string "-" (mympd-ip-acl-deny config))) ",")) + (serialize-list-of-strings "+" (mympd-ip-acl-allow config)) + (serialize-list-of-strings "-" (mympd-ip-acl-deny config))) ",")) ;; myMPD configuration fields are serialized as individual files under ;; /config/. -- 2.39.1 From unknown Fri Jun 20 07:19:24 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#62298] [PATCH v2 6/8] services: mpd: Set PulseAudio related variables as default value for environment-variables field. Resent-From: Bruno Victal Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 23 Mar 2023 15:05:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 62298 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 62298@debbugs.gnu.org Cc: ludo@gnu.org, Bruno Victal , liliana.prikler@gmail.com, maxim.cournoyer@gmail.com Received: via spool by 62298-submit@debbugs.gnu.org id=B62298.16795838636494 (code B ref 62298); Thu, 23 Mar 2023 15:05:03 +0000 Received: (at 62298) by debbugs.gnu.org; 23 Mar 2023 15:04:23 +0000 Received: from localhost ([127.0.0.1]:39110 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pfMUI-0001ga-MD for submit@debbugs.gnu.org; Thu, 23 Mar 2023 11:04:22 -0400 Received: from smtpmciv2.myservices.hosting ([185.26.107.238]:49024) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pfMUC-0001fx-L4 for 62298@debbugs.gnu.org; Thu, 23 Mar 2023 11:04:17 -0400 Received: from mail1.netim.hosting (unknown [185.26.106.173]) by smtpmciv2.myservices.hosting (Postfix) with ESMTP id E2FF720D6E; Thu, 23 Mar 2023 16:04:08 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by mail1.netim.hosting (Postfix) with ESMTP id 82C87800AE; Thu, 23 Mar 2023 16:04:08 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at mail1.netim.hosting Received: from mail1.netim.hosting ([127.0.0.1]) by localhost (mail1-2.netim.hosting [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id SCRwtDFABzpz; Thu, 23 Mar 2023 16:04:08 +0100 (CET) Received: from guix-nuc.home.arpa (bl9-119-177.dsl.telepac.pt [85.242.119.177]) (Authenticated sender: lumen@makinata.eu) by mail1.netim.hosting (Postfix) with ESMTPSA id E321A800AB; Thu, 23 Mar 2023 16:04:07 +0100 (CET) From: Bruno Victal Date: Thu, 23 Mar 2023 15:02:16 +0000 Message-Id: <1fd17a12b40197d1a9d1de8f1d762c86649c7a0a.1679583701.git.mirai@makinata.eu> X-Mailer: git-send-email 2.39.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 (-) These variables are necessary for PulseAudio to work properly out-of-the-box for 'non-interactive' users. * doc/guix.texi (Audio Services): Update environment-variables field description for mpd-configuration data type. * gnu/services/audio.scm (mpd-configuration)[environment-variables]: Set PULSE_CLIENTCONFIG and PULSE_CONFIG environment variables to the system-wide PulseAudio configuration. --- doc/guix.texi | 2 +- gnu/services/audio.scm | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index 2b62605b51..af9f7d78c0 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -33501,7 +33501,7 @@ Audio Services This is a list of symbols naming Shepherd services that this service will depend on. -@item @code{environment-variables} (default: @code{()}) (type: list-of-strings) +@item @code{environment-variables} (default: @code{("PULSE_CLIENTCONFIG=/etc/pulse/client.conf" "PULSE_CONFIG=/etc/pulse/daemon.conf")}) (type: list-of-strings) A list of strings specifying environment variables. @item @code{log-file} (default: @code{"/var/log/mpd/log"}) (type: maybe-string) diff --git a/gnu/services/audio.scm b/gnu/services/audio.scm index 56ea2f8638..198157a83b 100644 --- a/gnu/services/audio.scm +++ b/gnu/services/audio.scm @@ -361,7 +361,8 @@ (define-configuration mpd-configuration empty-serializer) (environment-variables - (list-of-strings '()) + (list-of-strings '("PULSE_CLIENTCONFIG=/etc/pulse/client.conf" + "PULSE_CONFIG=/etc/pulse/daemon.conf")) "A list of strings specifying environment variables." empty-serializer) -- 2.39.1 From unknown Fri Jun 20 07:19:24 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#62298] [PATCH v2 8/8] services: mympd: Use user-account (resp. user-group) for user (resp. group) fields. Resent-From: Bruno Victal Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 23 Mar 2023 15:05:04 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 62298 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 62298@debbugs.gnu.org Cc: ludo@gnu.org, Bruno Victal , liliana.prikler@gmail.com, maxim.cournoyer@gmail.com Received: via spool by 62298-submit@debbugs.gnu.org id=B62298.16795838636502 (code B ref 62298); Thu, 23 Mar 2023 15:05:04 +0000 Received: (at 62298) by debbugs.gnu.org; 23 Mar 2023 15:04:23 +0000 Received: from localhost ([127.0.0.1]:39112 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pfMUJ-0001gh-0w for submit@debbugs.gnu.org; Thu, 23 Mar 2023 11:04:23 -0400 Received: from smtpmciv2.myservices.hosting ([185.26.107.238]:49042) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pfMUG-0001gP-GF for 62298@debbugs.gnu.org; Thu, 23 Mar 2023 11:04:21 -0400 Received: from mail1.netim.hosting (unknown [185.26.106.173]) by smtpmciv2.myservices.hosting (Postfix) with ESMTP id 1F76A20DA2; Thu, 23 Mar 2023 16:04:09 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by mail1.netim.hosting (Postfix) with ESMTP id B7BF3800B4; Thu, 23 Mar 2023 16:04:09 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at mail1.netim.hosting Received: from mail1.netim.hosting ([127.0.0.1]) by localhost (mail1-2.netim.hosting [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id AAr9Q5touB7I; Thu, 23 Mar 2023 16:04:09 +0100 (CET) Received: from guix-nuc.home.arpa (bl9-119-177.dsl.telepac.pt [85.242.119.177]) (Authenticated sender: lumen@makinata.eu) by mail1.netim.hosting (Postfix) with ESMTPSA id 00D83800AC; Thu, 23 Mar 2023 16:04:08 +0100 (CET) From: Bruno Victal Date: Thu, 23 Mar 2023 15:02:18 +0000 Message-Id: <364a2fe961ddce2c4668c0c8b78f46bffe2c2096.1679583701.git.mirai@makinata.eu> X-Mailer: git-send-email 2.39.1 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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/audio.scm (%mympd-user, %mympd-group): New variable. (mympd-user-sanitizer, mympd-group-sanitizer): New procedure. (mympd-configuration)[user, group]: Set value type to user-account (resp. user-group). (mympd-serialize-configuration): Adapt for user-account values in user field. (mympd-accounts): Adapt for user-account (resp. user-group) in user (resp. group) field. --- doc/guix.texi | 4 +-- gnu/services/audio.scm | 74 ++++++++++++++++++++++++++++++++++-------- 2 files changed, 63 insertions(+), 15 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index 520a65b0b1..ee1e66b3ff 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -33732,10 +33732,10 @@ Audio Services This is a list of symbols naming Shepherd services that this service will depend on. -@item @code{user} (default: @code{"mympd"}) (type: string) +@item @code{user} (type: maybe-user-account) Owner of the @command{mympd} process. -@item @code{group} (default: @code{"nogroup"}) (type: string) +@item @code{group} (type: maybe-user-group) Owner group of the @command{mympd} process. @item @code{work-directory} (default: @code{"/var/lib/mympd"}) (type: string) diff --git a/gnu/services/audio.scm b/gnu/services/audio.scm index c168d1481c..f7f430039e 100644 --- a/gnu/services/audio.scm +++ b/gnu/services/audio.scm @@ -659,6 +659,54 @@ (define-configuration/no-serialization mympd-ip-acl (define-maybe/no-serialization integer) (define-maybe/no-serialization mympd-ip-acl) +;; XXX: These will shadow the previous definition used by mpd +;; and cause warnings to be shown. Maybe split the file +;; into audio/mpd.scm and audio/mympd.scm ? +#;(define-maybe/no-serialization user-account) +#;(define-maybe/no-serialization user-group) + +(define %mympd-user + (user-account + (name "mympd") + (group "mympd") + (system? #t) + (comment "myMPD user") + (home-directory "/var/empty") + (shell (file-append shadow "/sbin/nologin")))) + +(define %mympd-group + (user-group + (name "mympd") + (system? #t))) + +;;; TODO: procedures for unsupported value types, to be removed. +(define (mympd-user-sanitizer value) + (cond ((user-account? value) value) + ((string? value) + (warning (G_ "string value for 'user' is not supported, use \ +user-account instead~%")) + (user-account + (inherit %mympd-user) + (name value) + ;; XXX: this is to be lazily substituted in (…-accounts) + ;; with the value from 'group'. + (group %lazy-group))) + (else + (configuration-field-error #f 'user value)))) + +(define (mympd-group-sanitizer value) + (cond ((user-group? value) value) + ((string? value) + (warning (G_ "string value for 'group' is not supported, use \ +user-group instead~%")) + (user-group + (inherit %mympd-group) + (name value))) + (else + (configuration-field-error #f 'group value)))) +;;; + + ;; XXX: The serialization procedures are insufficient since we require ;; access to multiple fields at once. ;; Fields marked with empty-serializer are never serialized and are @@ -676,13 +724,15 @@ (define-configuration/no-serialization mympd-configuration empty-serializer) (user - (string "mympd") + (maybe-user-account %mympd-user) "Owner of the @command{mympd} process." + (sanitizer mympd-user-sanitizer) empty-serializer) (group - (string "nogroup") + (maybe-user-group %mympd-group) "Owner group of the @command{mympd} process." + (sanitizer mympd-group-sanitizer) empty-serializer) (work-directory @@ -817,7 +867,8 @@ (define (mympd-shepherd-service config) (match-record config (package shepherd-requirement user work-directory cache-directory log-level log-to) - (let ((log-level* (format #f "MYMPD_LOGLEVEL=~a" log-level))) + (let ((log-level* (format #f "MYMPD_LOGLEVEL=~a" log-level)) + (username (user-account-name user))) (shepherd-service (documentation "Run the myMPD daemon.") (requirement `(loopback user-processes @@ -825,7 +876,7 @@ (define (mympd-shepherd-service config) ,@shepherd-requirement)) (provision '(mympd)) (start #~(begin - (let* ((pw (getpwnam #$user)) + (let* ((pw (getpwnam #$username)) (uid (passwd:uid pw)) (gid (passwd:gid pw))) (for-each (lambda (dir) @@ -835,7 +886,7 @@ (define (mympd-shepherd-service config) (make-forkexec-constructor `(#$(file-append package "/bin/mympd") - "--user" #$user + "--user" #$username #$@(if (eqv? log-to 'syslog) '("--syslog") '()) "--workdir" #$work-directory "--cachedir" #$cache-directory) @@ -845,14 +896,11 @@ (define (mympd-shepherd-service config) (define (mympd-accounts config) (match-record config (user group) - (list (user-group (name group) - (system? #t)) - (user-account (name user) - (group group) - (system? #t) - (comment "myMPD user") - (home-directory "/var/empty") - (shell (file-append shadow "/sbin/nologin")))))) + ;; TODO: deprecation code, to be removed + (let ((user (if (eq? (user-account-group user) %lazy-group) + (inject-group-into-user user group) + user))) + (list user group)))) (define (mympd-log-rotation config) (match-record config (log-to) -- 2.39.1 From unknown Fri Jun 20 07:19:24 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#62298] [PATCH v2 7/8] services: mpd: Use user-account (resp. user-group) for user (resp. group) fields. Resent-From: Bruno Victal Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 23 Mar 2023 15:05:04 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 62298 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 62298@debbugs.gnu.org Cc: ludo@gnu.org, Bruno Victal , liliana.prikler@gmail.com, maxim.cournoyer@gmail.com Received: via spool by 62298-submit@debbugs.gnu.org id=B62298.16795838716524 (code B ref 62298); Thu, 23 Mar 2023 15:05:04 +0000 Received: (at 62298) by debbugs.gnu.org; 23 Mar 2023 15:04:31 +0000 Received: from localhost ([127.0.0.1]:39115 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pfMUQ-0001hA-Kv for submit@debbugs.gnu.org; Thu, 23 Mar 2023 11:04:31 -0400 Received: from smtpmciv2.myservices.hosting ([185.26.107.238]:49060) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pfMUK-0001gw-U4 for 62298@debbugs.gnu.org; Thu, 23 Mar 2023 11:04:25 -0400 Received: from mail1.netim.hosting (unknown [185.26.106.173]) by smtpmciv2.myservices.hosting (Postfix) with ESMTP id EE30520DA5; Thu, 23 Mar 2023 16:04:12 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by mail1.netim.hosting (Postfix) with ESMTP id 4E0D2800AF; Thu, 23 Mar 2023 16:04:09 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at mail1.netim.hosting Received: from mail1.netim.hosting ([127.0.0.1]) by localhost (mail1-2.netim.hosting [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id ZKJkJgbuxp7q; Thu, 23 Mar 2023 16:04:08 +0100 (CET) Received: from guix-nuc.home.arpa (bl9-119-177.dsl.telepac.pt [85.242.119.177]) (Authenticated sender: lumen@makinata.eu) by mail1.netim.hosting (Postfix) with ESMTPSA id 703A5800AD; Thu, 23 Mar 2023 16:04:08 +0100 (CET) From: Bruno Victal Date: Thu, 23 Mar 2023 15:02:17 +0000 Message-Id: X-Mailer: git-send-email 2.39.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 (-) Deprecate using strings for these fields and prefer user-account (resp. user-group) instead to avoid duplication within account-service-type. If a string value is encountered, it is ignored and a predefined variable is used instead. This is essentially a rollback to how it used to be before '5c5f0fc1135ff15f9c4adfc5f27eadd9a592b5d1'. Fixes #61570 . * gnu/services/audio.scm (mpd-serialize-user-account, mpd-serialize-user-group) (mpd-user-sanitizer, mpd-group-sanitizer): New procedure. (%mpd-user, %mpd-group): New variable. (mpd-configuration)[user, group]: Set value type to user-account (resp. user-group). (mpd-shepherd-service): Adapt for user-account values in user field. (mpd-accounts): Adapt for user-account (resp. user-group) in user (resp. group) field. * doc/guix.texi (Audio Services): Update documentation. --- doc/guix.texi | 4 +- gnu/services/audio.scm | 89 ++++++++++++++++++++++++++++++++++-------- 2 files changed, 74 insertions(+), 19 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index af9f7d78c0..520a65b0b1 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -33491,10 +33491,10 @@ Audio Services @item @code{package} (default: @code{mpd}) (type: file-like) The MPD package. -@item @code{user} (default: @code{"mpd"}) (type: string) +@item @code{user} (type: maybe-user-account) The user to run mpd as. -@item @code{group} (default: @code{"mpd"}) (type: string) +@item @code{group} (type: maybe-user-group) The group to run mpd as. @item @code{shepherd-requirement} (default: @code{()}) (type: list-of-symbol) diff --git a/gnu/services/audio.scm b/gnu/services/audio.scm index 198157a83b..c168d1481c 100644 --- a/gnu/services/audio.scm +++ b/gnu/services/audio.scm @@ -140,6 +140,14 @@ (define (uglify-field-name field-name) (define list-of-symbol? (list-of symbol?)) +;; helpers for deprecated field types, to be removed later +(define %lazy-group (make-symbol "%lazy-group")) + +(define (inject-group-into-user user group) + (user-account + (inherit user) + (group (user-group-name group)))) + ;;; ;;; MPD @@ -164,9 +172,32 @@ (define mpd-serialize-boolean mpd-serialize-field) (define (mpd-serialize-list-of-strings field-name value) #~(string-append #$@(map (cut mpd-serialize-string field-name <>) value))) +(define (mpd-serialize-user-account field-name value) + (mpd-serialize-string field-name (user-account-name value))) + +(define (mpd-serialize-user-group field-name value) + (mpd-serialize-string field-name (user-group-name value))) + (define-maybe string (prefix mpd-)) (define-maybe list-of-strings (prefix mpd-)) (define-maybe boolean (prefix mpd-)) +(define-maybe user-account (prefix mpd-)) +(define-maybe user-group (prefix mpd-)) + +(define %mpd-user + (user-account + (name "mpd") + (group "mpd") + (system? #t) + (comment "Music Player Daemon (MPD) user") + ;; MPD can use $HOME (or $XDG_CONFIG_HOME) to place its data + (home-directory "/var/lib/mpd") + (shell (file-append shadow "/sbin/nologin")))) + +(define %mpd-group + (user-group + (name "mpd") + (system? #t))) ;;; TODO: Procedures for deprecated fields, to be removed. @@ -197,6 +228,33 @@ (define (mpd-serialize-port field-name value) (define-maybe port (prefix mpd-)) +;;; procedures for unsupported value types, to be removed. + +(define (mpd-user-sanitizer value) + (cond ((user-account? value) value) + ((string? value) + (warning (G_ "string value for 'user' is deprecated, use \ +user-account instead~%")) + (user-account + (inherit %mpd-user) + (name value) + ;; XXX: this is to be lazily substituted in (mpd-accounts) + ;; with the value from 'group'. + (group %lazy-group))) + (else + (configuration-field-error #f 'user value)))) + +(define (mpd-group-sanitizer value) + (cond ((user-group? value) value) + ((string? value) + (warning (G_ "string value for 'group' is deprecated, use \ +user-group instead~%")) + (user-group + (inherit %mpd-group) + (name value))) + (else + (configuration-field-error #f 'group value)))) + ;;; ;; Generic MPD plugin record, lists only the most prevalent fields. @@ -347,12 +405,14 @@ (define-configuration mpd-configuration empty-serializer) (user - (string "mpd") - "The user to run mpd as.") + (maybe-user-account %mpd-user) + "The user to run mpd as." + (sanitizer mpd-user-sanitizer)) (group - (string "mpd") - "The group to run mpd as.") + (maybe-user-group %mpd-group) + "The group to run mpd as." + (sanitizer mpd-group-sanitizer)) (shepherd-requirement (list-of-symbol '()) @@ -516,7 +576,8 @@ (define (mpd-shepherd-service config) log-file playlist-directory db-file state-file sticker-file environment-variables) - (let* ((config-file (mpd-serialize-configuration config))) + (let ((config-file (mpd-serialize-configuration config)) + (username (user-account-name user))) (shepherd-service (documentation "Run the MPD (Music Player Daemon)") (requirement `(user-processes loopback ,@shepherd-requirement)) @@ -525,7 +586,7 @@ (define (mpd-shepherd-service config) (and=> #$(maybe-value log-file) (compose mkdir-p dirname)) - (let ((user (getpw #$user))) + (let ((user (getpw #$username))) (for-each (lambda (x) (when (and x (not (file-exists? x))) @@ -559,17 +620,11 @@ (define (mpd-shepherd-service config) (define (mpd-accounts config) (match-record config (user group) - (list (user-group - (name group) - (system? #t)) - (user-account - (name user) - (group group) - (system? #t) - (comment "Music Player Daemon (MPD) user") - ;; MPD can use $HOME (or $XDG_CONFIG_HOME) to place its data - (home-directory "/var/lib/mpd") - (shell (file-append shadow "/sbin/nologin")))))) + ;; TODO: deprecation code, to be removed + (let ((user (if (eq? (user-account-group user) %lazy-group) + (inject-group-into-user user group) + user))) + (list user group)))) (define mpd-service-type (service-type -- 2.39.1 From unknown Fri Jun 20 07:19:24 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#62298] [PATCH v2 5/8] services: mpd: Fix unintentional API breakage for mixer-type field. Resent-From: Bruno Victal Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 23 Mar 2023 15:10:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 62298 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 62298@debbugs.gnu.org Cc: ludo@gnu.org, Bruno Victal , liliana.prikler@gmail.com, maxim.cournoyer@gmail.com Received: via spool by 62298-submit@debbugs.gnu.org id=B62298.16795841787001 (code B ref 62298); Thu, 23 Mar 2023 15:10:01 +0000 Received: (at 62298) by debbugs.gnu.org; 23 Mar 2023 15:09:38 +0000 Received: from localhost ([127.0.0.1]:39124 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pfMZN-0001oq-OF for submit@debbugs.gnu.org; Thu, 23 Mar 2023 11:09:37 -0400 Received: from smtpmciv3.myservices.hosting ([185.26.107.239]:37234) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pfMZL-0001oi-AH for 62298@debbugs.gnu.org; Thu, 23 Mar 2023 11:09:35 -0400 Received: from mail1.netim.hosting (unknown [185.26.106.173]) by smtpmciv3.myservices.hosting (Postfix) with ESMTP id DE0722079A; Thu, 23 Mar 2023 16:09:32 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by mail1.netim.hosting (Postfix) with ESMTP id F1C67800B3; Thu, 23 Mar 2023 16:04:07 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at mail1.netim.hosting Received: from mail1.netim.hosting ([127.0.0.1]) by localhost (mail1-2.netim.hosting [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id 4RyTKLkZAaGN; Thu, 23 Mar 2023 16:04:07 +0100 (CET) Received: from guix-nuc.home.arpa (bl9-119-177.dsl.telepac.pt [85.242.119.177]) (Authenticated sender: lumen@makinata.eu) by mail1.netim.hosting (Postfix) with ESMTPSA id 616EF800AE; Thu, 23 Mar 2023 16:04:07 +0100 (CET) From: Bruno Victal Date: Thu, 23 Mar 2023 15:02:15 +0000 Message-Id: <12a3b44e8516829fd6ef5db2b5084f7c836b99e2.1679583701.git.mirai@makinata.eu> X-Mailer: git-send-email 2.39.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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/audio.scm (mpd-output)[mixer-type]: Use sanitizer to accept both strings and symbols as values. --- gnu/services/audio.scm | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/gnu/services/audio.scm b/gnu/services/audio.scm index e5b065a479..56ea2f8638 100644 --- a/gnu/services/audio.scm +++ b/gnu/services/audio.scm @@ -140,6 +140,11 @@ (define (uglify-field-name field-name) (define list-of-symbol? (list-of symbol?)) + +;;; +;;; MPD +;;; + (define (mpd-serialize-field field-name value) (let ((field (if (string? field-name) field-name (uglify-field-name field-name))) @@ -294,7 +299,17 @@ (define-configuration mpd-output for this audio output: the @code{hardware} mixer, the @code{software} mixer, the @code{null} mixer (allows setting the volume, but with no effect; this can be used as a trick to implement an external mixer -External Mixer) or no mixer (@code{none}).") +External Mixer) or no mixer (@code{none})." + (sanitizer + (lambda (x) ; TODO: deprecated, remove me later. + (cond + ((symbol? x) + (warning (G_ "symbol value for 'mixer-type' is deprecated, \ +use string instead~%")) + (symbol->string x)) + ((string? x) x) + (else + (configuration-field-error #f 'mixer-type x)))))) (replay-gain-handler maybe-string -- 2.39.1 From unknown Fri Jun 20 07:19:24 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#62298] [PATCH v2 7/8] services: mpd: Use user-account (resp. user-group) for user (resp. group) fields. Resent-From: Liliana Marie Prikler Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 23 Mar 2023 18:04:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 62298 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Bruno Victal , 62298@debbugs.gnu.org Cc: ludo@gnu.org, maxim.cournoyer@gmail.com Received: via spool by 62298-submit@debbugs.gnu.org id=B62298.16795946361651 (code B ref 62298); Thu, 23 Mar 2023 18:04:01 +0000 Received: (at 62298) by debbugs.gnu.org; 23 Mar 2023 18:03:56 +0000 Received: from localhost ([127.0.0.1]:39288 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pfPI4-0000QZ-0x for submit@debbugs.gnu.org; Thu, 23 Mar 2023 14:03:56 -0400 Received: from mail-ed1-f68.google.com ([209.85.208.68]:35718) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pfPI2-0000QK-A3 for 62298@debbugs.gnu.org; Thu, 23 Mar 2023 14:03:54 -0400 Received: by mail-ed1-f68.google.com with SMTP id y4so90497120edo.2 for <62298@debbugs.gnu.org>; Thu, 23 Mar 2023 11:03:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679594628; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:from:to:cc:subject :date:message-id:reply-to; bh=iYXm/cQ8O2VLXMkyOxmOXTwMuGgw64e5L6fE+urmcwE=; b=Qy4+e1hZSUnmWGadWjPkp50n3MkALYLUL+RsuakT6IwUSJxyvmEzupQjWX+5IOK4jd 0oq9jaoqVm1MJjy2gSa4XKMXLtDNK7ozL41sudz6XaI5dlMVHl783eMP3gOBvz4VuiP3 Apl3WmmZI0pMmr9YmgSQNQ5vwkrzx8Trw5xeXxIZx3IE8A1M0N5ARTrKmXJQ9o0z7dkv Kt1S8VohNDxusxM43uR868mZGja2/OY4lF54a8hn2vDQ0K4Mj0EACsbiSOt+IAPVz6AE OiXaY9XyfZm4+E5zSSarpwWbQh6hFYxV1FQyRpCPuVvXfe1yCAycfdOvmNqi/99deSZo nsgw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679594628; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=iYXm/cQ8O2VLXMkyOxmOXTwMuGgw64e5L6fE+urmcwE=; b=68eaNX313gz25U4foXyoE2FOcNn4F83LeUFKgz24q+SdZtfYqp+aO/7oIrXWUlwJzy JO7sZ++XhD18yd9ru+PcZ7NaEmJGxTEBcxLEziZqKpgnf2GXhBb2OoscE5rjzIu+K2Dp gWbFc0TsDiqQ7hb9IVPxwaWNKZ+JozLybCNAzyMK3bBvUjfJCkbWvPAQBfnJpp6zBcDc Cmnt/lmxf2ltx4vEA2cYWLhdXOplOA8Z8wrcFlvY7svIV+cS4hmi4y0lQ4ogF7HkFPkw Ban3N5SEHFjPm8NOr0RM2WPHLDn/1Nx5bnU+G3q4GNOlLUvcrDMmUmUHezQ/YecHdfWx T1IA== X-Gm-Message-State: AAQBX9er7Yf01bR4AYWnY+e9+KYVZPHADYJRXcS9gby/nIgHRL9kDums zjs6U8CXA6vZDnax1yJHfqg= X-Google-Smtp-Source: AKy350YvsPhvmjykv0GNEYhjVA5llG/f0XS1nv8MKOZca5M3egrOXUv9Qd8AmN6kDSTpLwiilneATA== X-Received: by 2002:aa7:da82:0:b0:502:100c:53a with SMTP id q2-20020aa7da82000000b00502100c053amr248530eds.41.1679594627970; Thu, 23 Mar 2023 11:03:47 -0700 (PDT) Received: from lumine.fritz.box (85-127-52-93.dsl.dynamic.surfer.at. [85.127.52.93]) by smtp.gmail.com with ESMTPSA id n11-20020a17090673cb00b0093dbb008281sm99751ejl.130.2023.03.23.11.03.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Mar 2023 11:03:47 -0700 (PDT) Message-ID: From: Liliana Marie Prikler Date: Thu, 23 Mar 2023 19:03:45 +0100 In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.46.0 MIME-Version: 1.0 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 (-) Am Donnerstag, dem 23.03.2023 um 15:02 +0000 schrieb Bruno Victal: > If a string value is encountered, it is ignored and a predefined > variable is used instead. This is essentially a rollback to how it > used to be before '5c5f0fc1135ff15f9c4adfc5f27eadd9a592b5d1'. As far as I can see, this is not actually what happens. Don't forget to update your commit messages :) > Fixes #61570 . You only need one newline after this one imho. > --- a/gnu/services/audio.scm > +++ b/gnu/services/audio.scm > @@ -140,6 +140,14 @@ (define (uglify-field-name field-name) > =C2=A0(define list-of-symbol? > =C2=A0=C2=A0 (list-of symbol?)) > =C2=A0 > +;; helpers for deprecated field types, to be removed later > +(define %lazy-group (make-symbol "%lazy-group")) > + > +(define (inject-group-into-user user group) > +=C2=A0 (user-account > +=C2=A0=C2=A0 (inherit user) > +=C2=A0=C2=A0 (group (user-group-name group)))) > + > =C2=A0=0C > =C2=A0;;; > =C2=A0;;; MPD > @@ -559,17 +620,11 @@ (define (mpd-shepherd-service config) > =C2=A0 > =C2=A0(define (mpd-accounts config) > =C2=A0=C2=A0 (match-record config (user group) > -=C2=A0=C2=A0=C2=A0 (list (user-group > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (name group= ) > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (system? #t= )) > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (user-account > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (name user) > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (group grou= p) > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (system? #t= ) > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (comment "M= usic Player Daemon (MPD) user") > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ;; MPD can = use $HOME (or $XDG_CONFIG_HOME) to place its > data > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (home-direc= tory "/var/lib/mpd") > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (shell (fil= e-append shadow "/sbin/nologin")))))) > +=C2=A0=C2=A0=C2=A0 ;; TODO: deprecation code, to be removed > +=C2=A0=C2=A0=C2=A0 (let ((user (if (eq? (user-account-group user) %lazy-= group) > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (inject-group-into-user user gro= up) > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 user))) > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (list user group)))) A little over-engineered, but works for me :) Cheers From unknown Fri Jun 20 07:19:24 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#62298] [PATCH v2 8/8] services: mympd: Use user-account (resp. user-group) for user (resp. group) fields. Resent-From: Liliana Marie Prikler Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 23 Mar 2023 19:20:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 62298 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Bruno Victal , 62298@debbugs.gnu.org Cc: ludo@gnu.org, maxim.cournoyer@gmail.com Received: via spool by 62298-submit@debbugs.gnu.org id=B62298.16795991749461 (code B ref 62298); Thu, 23 Mar 2023 19:20:02 +0000 Received: (at 62298) by debbugs.gnu.org; 23 Mar 2023 19:19:34 +0000 Received: from localhost ([127.0.0.1]:39346 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pfQTG-0002SX-08 for submit@debbugs.gnu.org; Thu, 23 Mar 2023 15:19:34 -0400 Received: from mail-wm1-f67.google.com ([209.85.128.67]:38678) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pfQTE-0002SE-81 for 62298@debbugs.gnu.org; Thu, 23 Mar 2023 15:19:32 -0400 Received: by mail-wm1-f67.google.com with SMTP id o40-20020a05600c512800b003eddedc47aeso1890272wms.3 for <62298@debbugs.gnu.org>; Thu, 23 Mar 2023 12:19:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679599166; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:from:to:cc:subject :date:message-id:reply-to; bh=Bl5acZuRQUaufzfCkAPJfEyf1aY3/BweoV1Vwx9p3lk=; b=KOb0iUz3KycxAfs61BiilI9i2WrQGI3FAFunxDRcmS657ohi7j2JfpVs0TqIYgLbAt SDNwW7YP4OB0Kyk2r0GIKRUJO0/a9mpH0CP/SGI5EMCLS8Ku/aLtiG6n7rM0LtlSZr0M jvs3cbZU9A1wEflZ6tQmHA1EsAKZiLCpWCMOUHrGmywM9J9FguCbJg1u8SuOFIl2yNLn sN3uLtCLPFzYpsGCSzTNoGm5LYeXXtmEt5gLhkAUWaIyZ375C/4kH5MnBQqd9Saqwbjw +zwzLlIvqz6OWRrBeK0qUXfXCZGRg58VA36IxiHmSwV1/l+851n+8fcLu3mMBt56ddlG nsjg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679599166; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=Bl5acZuRQUaufzfCkAPJfEyf1aY3/BweoV1Vwx9p3lk=; b=pXsfNFQRJaPoAYjtyE9sBUnBHRTma83i38N5muirnIoKXmh7caUw/sE3tnxUc4g2B1 PdApL2nir140tGy/bbw7a6fOHEgJ+42eMTVdSRUd0gUXUb2wxG09rziFhgI+dX5mo3aj lt8vHV40hbQqKhhq5rtxkfvszkmcDeAOBi42ui5LGLxM5hka7+wl9O9z/VBVov6Oaoos FlYoIT+3hz0kkfLCjS7uYFYy5OOVqO6jXBzcjnag/hUBVr+W1a5KDionDDbGPWVaLxXa F/oNg6+/LthMvMzEXxhEWLfcnUaJxGeJl1e01u9CQt/BBoHsuu/IabPXtJv/L6hi2AMh AcKQ== X-Gm-Message-State: AO0yUKV0wq0/BTExMden+xfhS7ZFCs/eRCXxw6j/jrPZ6oZlzJemH2Jw 4Jg2AGVXQlp0prRnl5F6s9A= X-Google-Smtp-Source: AK7set/OAhJeS+qwvdrnZAvJWri/8UQjfZ/O2OTN42D/P7e2caKhOLxFEC2YAK04xPK4RHxjL+/MVQ== X-Received: by 2002:a05:600c:225a:b0:3eb:3843:9f31 with SMTP id a26-20020a05600c225a00b003eb38439f31mr483178wmm.10.1679599166138; Thu, 23 Mar 2023 12:19:26 -0700 (PDT) Received: from lumine.fritz.box (85-127-52-93.dsl.dynamic.surfer.at. [85.127.52.93]) by smtp.gmail.com with ESMTPSA id t8-20020a05600c198800b003ede03e4369sm2862702wmq.33.2023.03.23.12.19.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Mar 2023 12:19:25 -0700 (PDT) Message-ID: From: Liliana Marie Prikler Date: Thu, 23 Mar 2023 20:19:24 +0100 In-Reply-To: <364a2fe961ddce2c4668c0c8b78f46bffe2c2096.1679583701.git.mirai@makinata.eu> References: <364a2fe961ddce2c4668c0c8b78f46bffe2c2096.1679583701.git.mirai@makinata.eu> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: base64 User-Agent: Evolution 3.46.0 MIME-Version: 1.0 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 (-) QW0gRG9ubmVyc3RhZywgZGVtIDIzLjAzLjIwMjMgdW0gMTU6MDIgKzAwMDAgc2NocmllYiBCcnVu byBWaWN0YWw6Cj4gKyhkZWZpbmUgJW15bXBkLXVzZXIKPiArwqAgKHVzZXItYWNjb3VudAo+ICvC oMKgwqDCoMKgIChuYW1lICJteW1wZCIpCj4gK8KgwqDCoMKgwqAgKGdyb3VwICJteW1wZCIpCj4g K8KgwqDCoMKgwqAgKHN5c3RlbT8gI3QpCj4gK8KgwqDCoMKgwqAgKGNvbW1lbnQgIm15TVBEIHVz ZXIiKQo+ICvCoMKgwqDCoMKgIChob21lLWRpcmVjdG9yeSAiL3Zhci9lbXB0eSIpCj4gK8KgwqDC oMKgwqAgKHNoZWxsIChmaWxlLWFwcGVuZCBzaGFkb3cgIi9zYmluL25vbG9naW4iKSkpKQo+ICsK PiArKGRlZmluZSAlbXltcGQtZ3JvdXAKPiArwqAgKHVzZXItZ3JvdXAKPiArwqDCoCAobmFtZSAi bXltcGQiKQo+ICvCoMKgIChzeXN0ZW0/ICN0KSkpCj4gKwo+ICs7OzsgVE9ETzogcHJvY2VkdXJl cyBmb3IgdW5zdXBwb3J0ZWQgdmFsdWUgdHlwZXMsIHRvIGJlIHJlbW92ZWQuCj4gKyhkZWZpbmUg KG15bXBkLXVzZXItc2FuaXRpemVyIHZhbHVlKQo+ICvCoCAoY29uZCAoKHVzZXItYWNjb3VudD8g dmFsdWUpIHZhbHVlKQo+ICvCoMKgwqDCoMKgwqDCoCAoKHN0cmluZz8gdmFsdWUpCj4gK8KgwqDC oMKgwqDCoMKgwqAgKHdhcm5pbmcgKEdfICJzdHJpbmcgdmFsdWUgZm9yICd1c2VyJyBpcyBub3Qg c3VwcG9ydGVkLCB1c2UKPiBcCj4gK3VzZXItYWNjb3VudCBpbnN0ZWFkfiUiKSkKPiArwqDCoMKg wqDCoMKgwqDCoCAodXNlci1hY2NvdW50Cj4gK8KgwqDCoMKgwqDCoMKgwqDCoCAoaW5oZXJpdCAl bXltcGQtdXNlcikKPiArwqDCoMKgwqDCoMKgwqDCoMKgIChuYW1lIHZhbHVlKQo+ICvCoMKgwqDC oMKgwqDCoMKgwqAgOzsgWFhYOiB0aGlzIGlzIHRvIGJlIGxhemlseSBzdWJzdGl0dXRlZCBpbiAo 4oCmLWFjY291bnRzKQo+ICvCoMKgwqDCoMKgwqDCoMKgwqAgOzvCoMKgwqDCoMKgIHdpdGggdGhl IHZhbHVlIGZyb20gJ2dyb3VwJy4KPiArwqDCoMKgwqDCoMKgwqDCoMKgIChncm91cCAlbGF6eS1n cm91cCkpKQo+ICvCoMKgwqDCoMKgwqDCoCAoZWxzZQo+ICvCoMKgwqDCoMKgwqDCoMKgIChjb25m aWd1cmF0aW9uLWZpZWxkLWVycm9yICNmICd1c2VyIHZhbHVlKSkpKQpJIHRoaW5rIGFuIGluLXBs YWNlIGNyZWF0aW9uIG9mIHRoZSB1c2VyIGFuZCBncm91cCBtaWdodCBtYWtlIG1vcmUKc2Vuc2Ug dGhhbiBkZWZpbmluZyBhIGR1bW15IHZhbHVlIGZvciBpbmhlcml0YW5jZSBwdXJwb3Nlcy4gIFNh bWUKcHJvYmFibHkgYWxzbyBhcHBsaWVzIHRvIHRoZSBNUEQgc2VydmljZSBwYXRjaC4KCkNoZWVy cwoK From unknown Fri Jun 20 07:19:24 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#62298] [PATCH v2 1/8] services: configuration: Add user-defined sanitizer support. Resent-From: Liliana Marie Prikler Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 23 Mar 2023 19:48:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 62298 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Bruno Victal , 62298@debbugs.gnu.org Cc: ludo@gnu.org, maxim.cournoyer@gmail.com Received: via spool by 62298-submit@debbugs.gnu.org id=B62298.167960084112585 (code B ref 62298); Thu, 23 Mar 2023 19:48:02 +0000 Received: (at 62298) by debbugs.gnu.org; 23 Mar 2023 19:47:21 +0000 Received: from localhost ([127.0.0.1]:39374 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pfQu9-0003Gv-Ed for submit@debbugs.gnu.org; Thu, 23 Mar 2023 15:47:21 -0400 Received: from mail-ed1-f68.google.com ([209.85.208.68]:42671) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pfQu7-0003Gh-KI for 62298@debbugs.gnu.org; Thu, 23 Mar 2023 15:47:19 -0400 Received: by mail-ed1-f68.google.com with SMTP id o12so91422382edb.9 for <62298@debbugs.gnu.org>; Thu, 23 Mar 2023 12:47:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679600834; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:from:to:cc:subject :date:message-id:reply-to; bh=ZFpb+LKslzdPMT+Y/ZU/am8xt+5GCiug+hEkjYYfpYc=; b=S69RpiJIrdKflmKGTtHGXUl77mLyPAJz7vd6i4xLsbdbX+jQnwPWcSfA8jgtThSbc5 9c44XuWV3r05B3yBKVhKROYObEfLsw9GBwGk6Rk7xQUjxQAajVO+FwQTRMB5lLqP4b8P rW7dpfjwga9X8+oqDtjYpUbxcrlSq6MgPsH51BkbLW4bXxZDoLFTWmcjWh9lZQJVLpK+ /l2Jemg+0TfBN4q+vgZM7gnYq7vLPgu3T/5SMsAn0RNz8GcR+dRTMKk/KI7cyyK/43Mq mruEZ9uyhyyuPVnri0XjDGByKzOMhoFaJlZcsuRqe93Iqtng9JFhrDPUIrG9cwnxJknM kxlw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679600834; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=ZFpb+LKslzdPMT+Y/ZU/am8xt+5GCiug+hEkjYYfpYc=; b=rAY+PgZtn/9+vaeFWBwrQ5IiNbUHisH36QyQjcg5p30j9BurmNfMV2Uqb8+eZp+Fkb BR9uGfnHubwdGPl98H0KtIphrG2vmFPDqjRBxa9mkh2xw0jqBFLDlwNqYZTKPs2fz1qk pNgkq3dTJHlR6p4nw07hKRVccU3EcqhQNw7/AhbQ+rWCsO1Hpg/8nZLRIyKq8ZXuxK+9 YIWvWG7EWVso5iSEpQ+LE0GRFi/8rqq9XtpKdroolfrHm38jOifMMbog/EHDYx3A3OuL DF5j/o9d0lz9LHJKZBprJZNOELZp8/rmKeoELELiJgQenMy0tLCEVmMjymr/IK7mo6QZ zTTw== X-Gm-Message-State: AAQBX9dST87/Dyd0Dilge9Epo3uI8AoOZEAfkiaZYxWqsYLCtGhjMZOg kiH4AEseSxurp5PlEA37XR1y3Q92OoNlSA== X-Google-Smtp-Source: AKy350ZbpKE51fcbUbkHEQeLSrmMUQ5h5tdZb5gUt5C12194KbtPZOtO7FRZh3lpTYj46PVB2qyyNA== X-Received: by 2002:a17:907:6d1b:b0:93d:e2d0:6d1c with SMTP id sa27-20020a1709076d1b00b0093de2d06d1cmr154687ejc.17.1679600833836; Thu, 23 Mar 2023 12:47:13 -0700 (PDT) Received: from lumine.fritz.box (85-127-52-93.dsl.dynamic.surfer.at. [85.127.52.93]) by smtp.gmail.com with ESMTPSA id p13-20020a1709066a8d00b00932ab7699ffsm8318920ejr.148.2023.03.23.12.47.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Mar 2023 12:47:13 -0700 (PDT) Message-ID: <9c0ceb5cbffa2bc57ae3a5d88394a01a6895f365.camel@gmail.com> From: Liliana Marie Prikler Date: Thu, 23 Mar 2023 20:47:12 +0100 In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.46.0 MIME-Version: 1.0 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 (-) Am Donnerstag, dem 23.03.2023 um 15:02 +0000 schrieb Bruno Victal: > +@var{sanitizer} is the name of a procedure which takes one argument, @var{sanitizer} is a procedure > +a user-supplied value, and returns a ``sanitized'' value for the > field. > +If none is specified, the predicate @code{@var{type}?} is > automatically > +used to construct an internal sanitizer that asserts the type > correctness > +of the field value. If no sanitizer is specified, a default sanitizer is used, which raises an error if the value is not of @var{type}. > =C2=A0@var{serializer} is the name of a procedure which takes two > arguments, @var{serializer} is a procedure, which takes two arguments, a name of a field and the value of said field. Cheers From unknown Fri Jun 20 07:19:24 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#62298] [PATCH v2 4/8] services: mympd: Require 'syslog service when configured to log to syslog. Resent-From: Maxim Cournoyer Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 24 Mar 2023 14:54:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 62298 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Bruno Victal Cc: 62298@debbugs.gnu.org, ludo@gnu.org, liliana.prikler@gmail.com Received: via spool by 62298-submit@debbugs.gnu.org id=B62298.167966964115476 (code B ref 62298); Fri, 24 Mar 2023 14:54:02 +0000 Received: (at 62298) by debbugs.gnu.org; 24 Mar 2023 14:54:01 +0000 Received: from localhost ([127.0.0.1]:41131 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pfino-00041X-MG for submit@debbugs.gnu.org; Fri, 24 Mar 2023 10:54:00 -0400 Received: from mail-qt1-f178.google.com ([209.85.160.178]:36856) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pfinn-00041L-Ln for 62298@debbugs.gnu.org; Fri, 24 Mar 2023 10:54:00 -0400 Received: by mail-qt1-f178.google.com with SMTP id hf2so1688731qtb.3 for <62298@debbugs.gnu.org>; Fri, 24 Mar 2023 07:53:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679669634; h=mime-version:user-agent:message-id:in-reply-to:date:references :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=vOinnVx3zB2t+MHwvsAUejMJHNWbx/lBruAHwRyr+3I=; b=Ndcmk2RjZVPZxRbaSZRa/fUs/2p34L+mgbLLlzQTmlEp+JosBVwUP/Pa1jNJkQ8lnV r1NOK3wC6Mwr/N2gcGTHcO3SndsKp1Ch0eP6Ricl6Uz3ioTl2V7Tp7dw8CdZAjaJaZ6M o5i/mjXNSz1du7OEVgBG8aV3WyLWEuV4LzkJpPunT16a+IQaxJdFahrSmihRkEEcILkw mi/N4tOSiVUfStpURYykSAXJLlWpTQnquVtANMGVW7fr/CpIIUqUTLNIq5HkOjobN+a7 jAujZQh1yPGEtlPG8Q2JAeg/D33O6x49VVSj9MKKPaK+xE6w5NjZSWhV6Av4fBVlzeQ0 0ZBw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679669634; h=mime-version:user-agent:message-id:in-reply-to:date:references :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=vOinnVx3zB2t+MHwvsAUejMJHNWbx/lBruAHwRyr+3I=; b=oyNnWStmG9EvlfS4tZvp9ig8m3eXLqZQO/YARlspT1c7Ntr+hgS075NddNvUGM7V88 82vyn04B0mbQhUyuqPU9uUup2dcdUHzwk1Cyia6gIeuQ1pPf5hM/bAFfBgOWcKXyWWjb oto6Fyx3paf5MllulicC2LTupFdiclmBkCwOJ02WAyuDqOnqjFS2DnnJc0TfXc7cwqMX vm+1iCRYZN4WOPZyPTstZt6R1AZpX214XacgvRy/q2mWUXeypEHSfXMOWC2Zu2+LJM8l rBGPZQEjYI0huZDPoQ42hzo7Bi8jJy6fIF8ZUtrhk/31X4pxUB1ANJaYLrQtDN5oqaeD XJ8A== X-Gm-Message-State: AO0yUKVeiDbsWi929aKOCbUc733Z/aBXwvMwxQw8SNpJG315uPSZEKZE cA4MbUTjunkHfd4MQZEbREvlY26KF8Gd4A== X-Google-Smtp-Source: AK7set/rqIZLehZcOZDsxme4t4fwMQvjv9yuOK0TVL2tNrTyrTlOxaCJ5NE0cnWhnBFJksNhkjbqmg== X-Received: by 2002:a05:622a:1d0:b0:3e3:7c94:7270 with SMTP id t16-20020a05622a01d000b003e37c947270mr5646101qtw.59.1679668339370; Fri, 24 Mar 2023 07:32:19 -0700 (PDT) Received: from hurd (dsl-155-54.b2b2c.ca. [66.158.155.54]) by smtp.gmail.com with ESMTPSA id s16-20020ac85290000000b003e38c9a2a22sm3380107qtn.92.2023.03.24.07.32.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Mar 2023 07:32:18 -0700 (PDT) From: Maxim Cournoyer References: <96e6404d84211c766924d2fcd4f88d33c11cacfe.1679583701.git.mirai@makinata.eu> Date: Fri, 24 Mar 2023 10:32:17 -0400 In-Reply-To: <96e6404d84211c766924d2fcd4f88d33c11cacfe.1679583701.git.mirai@makinata.eu> (Bruno Victal's message of "Thu, 23 Mar 2023 15:02:14 +0000") Message-ID: <87ileqz0cu.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain 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 (-) Hi, Bruno Victal writes: > * gnu/services/audio.scm (mympd-shepherd-service): Depend on 'syslog when > configured to log to syslog. > --- > gnu/services/audio.scm | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/gnu/services/audio.scm b/gnu/services/audio.scm > index e9ecccd614..e5b065a479 100644 > --- a/gnu/services/audio.scm > +++ b/gnu/services/audio.scm > @@ -749,7 +749,9 @@ (define (mympd-shepherd-service config) > (let ((log-level* (format #f "MYMPD_LOGLEVEL=~a" log-level))) > (shepherd-service > (documentation "Run the myMPD daemon.") > - (requirement `(loopback user-processes ,@shepherd-requirement)) > + (requirement `(loopback user-processes > + ,@(if (eqv? log-to 'syslog) '(syslog) '()) eq? is sufficient to compare symbols. Otherwise, LGTM. -- Thanks, Maxim From unknown Fri Jun 20 07:19:24 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#62298] [PATCH v2 2/8] services: replace bare serializers with (serializer ...) Resent-From: Maxim Cournoyer Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 24 Mar 2023 14:56:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 62298 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Bruno Victal Cc: 62298@debbugs.gnu.org, ludo@gnu.org, liliana.prikler@gmail.com Received: via spool by 62298-submit@debbugs.gnu.org id=B62298.167966975615674 (code B ref 62298); Fri, 24 Mar 2023 14:56:01 +0000 Received: (at 62298) by debbugs.gnu.org; 24 Mar 2023 14:55:56 +0000 Received: from localhost ([127.0.0.1]:41134 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pfipg-00044k-5j for submit@debbugs.gnu.org; Fri, 24 Mar 2023 10:55:56 -0400 Received: from mail-yw1-f176.google.com ([209.85.128.176]:42650) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pfipf-00044Y-3O for 62298@debbugs.gnu.org; Fri, 24 Mar 2023 10:55:55 -0400 Received: by mail-yw1-f176.google.com with SMTP id 00721157ae682-544f7c176easo37233587b3.9 for <62298@debbugs.gnu.org>; Fri, 24 Mar 2023 07:55:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679669748; h=mime-version:user-agent:message-id:in-reply-to:date:references :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=P+SeGUhgIKLmlM/inVAQ5szJqNqt2+lZDCkzeS+jHrk=; b=OyE881MOpHdd7OBuqenc1nHgtXWlesN/Yp3sfKY0BqSeBnvQ0OT2WZDwiTgCGnkFDp qkRqHnBACNqnQELqy3zjW0TN4lNXlz3ne33yyPesp4/xHhwEaYzN0qMQLDqHjFKUpCOX SSo8EhdUXd0l7wboHocZJtdSJs1GP73zFbNwYUDBcyYye+0Zj19ZWvySj6JCqOKi7JmN 8woBKOHwqW40ye0PX4aOUsrTQckZhkVRkZQUYE3XgpXZ2WCKAmpzDH/knFJ1fMqjYnRm zhDeQgmMAmM5MrncV93acXv6bdBqbFHlSuwPvBjP55KJuvxStLBxnDw/IC+6eLogXNFR QGiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679669748; h=mime-version:user-agent:message-id:in-reply-to:date:references :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=P+SeGUhgIKLmlM/inVAQ5szJqNqt2+lZDCkzeS+jHrk=; b=5hXj4IkOo8N+//s1JrQY7qY5ctKtX4yWsqXgFm8xgpPninsLzHMH0K+C8vq9osWLog sCrULBx/U7HFD2b84AtyveoLzKGLI0e6dDoYXkXk6cbwnOBA9bzufXZeBWeJiAJjpIt6 h94gD0QPa/69eXoZNRgpL5kvLmr2QKmZ2T7VOQZ8v+xzO9I5paqIM9kiZLim99dTbh4M +h3I56JFw/bgpxmzGV88sLHzkwp24kk57E7Euzke0WhBvwtIwak05l0tLinBrn8ENdVt mPz8Kuw9ohASjOTAHGMgT9op+9/9nuRUEgvSu2dpvawHKqxv+IQONyEzvS43172qsz56 CbQQ== X-Gm-Message-State: AAQBX9d3LA3eqYJ2L+2/qHqNhujQPL8ancFWyKagfTKwatXMz2bjl7ji hJAiMYNKJwWxaqEB/WmUS8A= X-Google-Smtp-Source: AKy350Zg6ziy+03m2ZIZv1W2jCPMrX7wpTqszkkNh6b7lhw7W8y6Pq+zkDnsaepXTPKyjnqEMAklnQ== X-Received: by 2002:ad4:4eaf:0:b0:5a9:5285:13e2 with SMTP id ed15-20020ad44eaf000000b005a9528513e2mr5163058qvb.4.1679668087408; Fri, 24 Mar 2023 07:28:07 -0700 (PDT) Received: from hurd (dsl-155-54.b2b2c.ca. [66.158.155.54]) by smtp.gmail.com with ESMTPSA id s12-20020ac8758c000000b003e389560a05sm4223956qtq.51.2023.03.24.07.28.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Mar 2023 07:28:07 -0700 (PDT) From: Maxim Cournoyer References: Date: Fri, 24 Mar 2023 10:28:05 -0400 In-Reply-To: (Bruno Victal's message of "Thu, 23 Mar 2023 15:02:12 +0000") Message-ID: <87mt42z0ju.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain 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 (-) Bruno Victal writes: > * gnu/home/services/shells.scm (home-zsh-configuration)[environment-variables]: Use (serializer ...). > (home-bash-configuration)[aliases, environment-variables]: Ditto. > (home-fish-configuration)[abbreviations, aliases, environment-variables]: Ditto. > * gnu/services/audio.scm (mpd-configuration)[music-dir, playlist-dir, endpoints] > [address, inputs, archive-plugins, input-cache-size, decoders, filters, playlist-plugins]: Ditto. > * gnu/services/linux.scm (fstrim-configuration)[extra-arguments]: Ditto. > * gnu/services/security.scm (fail2ban-jail-configuration)[backend, log-encoding, extra-content]: Ditto. > * tests/services/configuration.scm: Update tests. Add test for deprecated bare serializers. The commit message should be line-wrapped around 80 chars and the title should be puncutated like: "services: Replace [...] ." The rest LGTM. -- Thanks, Maxim From unknown Fri Jun 20 07:19:24 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#62298] [PATCH v2 1/8] services: configuration: Add user-defined sanitizer support. Resent-From: Maxim Cournoyer Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 24 Mar 2023 14:57:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 62298 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Bruno Victal Cc: 62298@debbugs.gnu.org, ludo@gnu.org, liliana.prikler@gmail.com Received: via spool by 62298-submit@debbugs.gnu.org id=B62298.167966979215754 (code B ref 62298); Fri, 24 Mar 2023 14:57:01 +0000 Received: (at 62298) by debbugs.gnu.org; 24 Mar 2023 14:56:32 +0000 Received: from localhost ([127.0.0.1]:41137 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pfiqF-00045z-H5 for submit@debbugs.gnu.org; Fri, 24 Mar 2023 10:56:32 -0400 Received: from mail-vs1-f45.google.com ([209.85.217.45]:46035) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pfiqD-00045k-8m for 62298@debbugs.gnu.org; Fri, 24 Mar 2023 10:56:29 -0400 Received: by mail-vs1-f45.google.com with SMTP id c10so1700914vsh.12 for <62298@debbugs.gnu.org>; Fri, 24 Mar 2023 07:56:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679669778; h=content-transfer-encoding:mime-version:user-agent:message-id :in-reply-to:date:references:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to; bh=lWB1O5uQg+xVlJd8vCmCM8XQRn1Y5oVC4URjecw+CGE=; b=FJsvIp7ol1R2WNo8j9/O7kxwJHHgo4WC00bWmuP4pcw/RL/VfB6kEM6eCmFRuyVyla 2g1Et6WrEXMYsPvxLfVcJ9LhHPEjhzNExoZ+lxNhW2S6Oq7VRxdsrkYypl8zONp/9nLo ytR6ms1da+h7fha8srRgeFZtmmqNO0oalPtPYiEflBmMG3aWPwfhB73QlNFNwYIqQPSS gYhI00df2rEaVA2P/UvpYq27ptauQ7fdkafLepc8TFvr6nWtJlRDu7jqqtKY9OIphBAJ jMx7Qwtm5dG5w/iKbUDHa/xmJc/iqlXe3T74N6Tp8FIwttdCHkmEzN0nfYn9LD9wVXrs vNBw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679669778; h=content-transfer-encoding:mime-version:user-agent:message-id :in-reply-to:date:references:subject:cc:to:from:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=lWB1O5uQg+xVlJd8vCmCM8XQRn1Y5oVC4URjecw+CGE=; b=Bj13+BiFV5kKYhn+wS6hVYlndR3evN0vfA5BpANWhTduFy17+mW376t71R9WfvzVOb pimlAMmt8bjbOSgHRVZh8+ZxjihJHQVjflPHROgokto5KPKogq66/5FK78Lld6tF343b WhteMWldOUUecthGkZrz6NYR8f3zZtd2Sl2AfR6Wu9I8GgNuGco04TixQUDo0mkXH2gc TIMop9/xj+D++Y6rYZR2Y1eGHHLNB1HPzqyWgGLK5Png4mSWBDlaE/CMndcHpjKak81P /itby2JhoUheefYZU05BJ9dybnmPXgtMiXgfUdNCwxaMd5tcafvNy4CWf5h6ebuFqxjw uoFg== X-Gm-Message-State: AAQBX9dZOSefzgxK16GaZAsUSSVAg9yCxHzXOahKRandFROrLX1mwGuP e7XZdcQtbVC2Xr0evafshDHl3GYBMzVppA== X-Google-Smtp-Source: AKy350ZFcRSNdCWxJcwGOYBKIFiUSxkTfsHrl9zZbX6Bjw2DUbpTCKEYuY2OUjOa3L14lFUAIL9lAA== X-Received: by 2002:a05:6214:500e:b0:5ba:168d:d3fc with SMTP id jo14-20020a056214500e00b005ba168dd3fcmr5475844qvb.4.1679667939660; Fri, 24 Mar 2023 07:25:39 -0700 (PDT) Received: from hurd (dsl-155-54.b2b2c.ca. [66.158.155.54]) by smtp.gmail.com with ESMTPSA id m64-20020a375843000000b0073b8512d2dbsm14158059qkb.72.2023.03.24.07.25.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Mar 2023 07:25:39 -0700 (PDT) From: Maxim Cournoyer References: Date: Fri, 24 Mar 2023 10:25:37 -0400 In-Reply-To: (Bruno Victal's message of "Thu, 23 Mar 2023 15:02:11 +0000") Message-ID: <87r0tez0ny.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) 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: -1.0 (-) Hello! Bruno Victal writes: > This changes the 'custom-serializer' field into a generic > 'extra-args' field that can be extended to support new literals. > With this mechanism, the literals 'sanitizer' allow for user-defined > sanitizer procedures while the 'serializer' literal is used for > custom serializer procedures. > The 'empty-serializer' was also added as a 'literal' and can be used > just like it was previously. > > With the repurposing of 'custom-serializer' into 'extra-args', to prevent > intolerable confusion, the custom serializer procedures should be > specified using the new 'literals' approach, with the previous =E2=80=9Cs= tyle=E2=80=9D > being considered deprecated. > > * gnu/services/configuration.scm (define-configuration-helper): > Rename 'custom-serializer' to 'extra-args'. > Add support for literals 'sanitizer', 'serializer' and 'empty-serializer'. > Rename procedure 'field-sanitizer' to 'default-field-sanitizer' to avoid = syntax clash. > Only define default field sanitizers if user-defined ones are absent. > (normalize-extra-args): New procedure. > ()[sanitizer]: New field. > > * doc/guix.texi (Complex Configurations): Document the newly added litera= ls. > > * tests/services/configuration.scm: Add tests for the new literals. Interesting work! > --- > doc/guix.texi | 30 ++++- > gnu/services/configuration.scm | 91 +++++++++++---- > tests/services/configuration.scm | 185 ++++++++++++++++++++++++++++++- > 3 files changed, 280 insertions(+), 26 deletions(-) > > diff --git a/doc/guix.texi b/doc/guix.texi > index dfdb26103a..1609e508ef 100644 > --- a/doc/guix.texi > +++ b/doc/guix.texi > @@ -41216,7 +41216,7 @@ Complex Configurations > (@var{field-name} > (@var{type} @var{default-value}) > @var{documentation} > - @var{serializer}) > + (serializer @var{serializer})) >=20=20 > (@var{field-name} > (@var{type}) > @@ -41225,7 +41225,18 @@ Complex Configurations > (@var{field-name} > (@var{type}) > @var{documentation} > - @var{serializer}) > + (serializer @var{serializer})) > + > +(@var{field-name} > + (@var{type}) > + @var{documentation} > + (sanitizer @var{sanitizer}) > + > +(@var{field-name} > + (@var{type}) > + @var{documentation} > + (sanitizer @var{sanitizer}) > + (serializer @var{serializer})) > @end example >=20=20 > @var{field-name} is an identifier that denotes the name of the field in > @@ -41248,6 +41259,21 @@ Complex Configurations > @var{documentation} is a string formatted with Texinfo syntax which > should provide a description of what setting this field does. >=20=20 > +@var{sanitizer} is the name of a procedure which takes one argument, > +a user-supplied value, and returns a ``sanitized'' value for the field. > +If none is specified, the predicate @code{@var{type}?} is automatically > +used to construct an internal sanitizer that asserts the type correctness > +of the field value. > + > +An example of a sanitizer for a field that accepts both strings and > +symbols looks like this: > +@lisp > +(define (sanitize-foo value) > + (cond ((string? value) value) > + ((symbol? value) (symbol->string value)) > + (else (throw 'bad! value)))) > +@end lisp I'd use the more conventional (error "bad value" value) in the example. > @var{serializer} is the name of a procedure which takes two arguments, > the first is the name of the field, and the second is the value > corresponding to the field. The procedure should return a string or > diff --git a/gnu/services/configuration.scm b/gnu/services/configuration.= scm > index 174c2f20d2..409d4cef00 100644 > --- a/gnu/services/configuration.scm > +++ b/gnu/services/configuration.scm > @@ -6,6 +6,7 @@ > ;;; Copyright =C2=A9 2021, 2022 Maxim Cournoyer > ;;; Copyright =C2=A9 2021 Andrew Tropin > ;;; Copyright =C2=A9 2022 Maxime Devos > +;;; Copyright =C2=A9 2023 Bruno Victal > ;;; > ;;; This file is part of GNU Guix. > ;;; > @@ -28,7 +29,8 @@ (define-module (gnu services configuration) > #:use-module (guix gexp) > #:use-module ((guix utils) #:select (source-properties->location)) > #:use-module ((guix diagnostics) > - #:select (formatted-message location-file &error-locatio= n)) > + #:select (formatted-message location-file &error-location > + warning)) > #:use-module ((guix modules) #:select (file-name->module-name)) > #:use-module (guix i18n) > #:autoload (texinfo) (texi-fragment->stexi) > @@ -37,6 +39,7 @@ (define-module (gnu services configuration) > #:use-module (ice-9 format) > #:use-module (ice-9 match) > #:use-module (srfi srfi-1) > + #:use-module (srfi srfi-26) > #:use-module (srfi srfi-34) > #:use-module (srfi srfi-35) > #:export (configuration-field > @@ -44,6 +47,7 @@ (define-module (gnu services configuration) > configuration-field-type > configuration-missing-field > configuration-field-error > + configuration-field-sanitizer > configuration-field-serializer > configuration-field-getter > configuration-field-default-value-thunk > @@ -116,6 +120,7 @@ (define-record-type* > (type configuration-field-type) > (getter configuration-field-getter) > (predicate configuration-field-predicate) > + (sanitizer configuration-field-sanitizer) > (serializer configuration-field-serializer) > (default-value-thunk configuration-field-default-value-thunk) > (documentation configuration-field-documentation)) > @@ -181,11 +186,45 @@ (define (normalize-field-type+def s) > (values #'(field-type %unset-value))))) >=20=20 > (define (define-configuration-helper serialize? serializer-prefix syn) > + > + (define (normalize-extra-args s) A docstring would help here, explaining what this helper is for. > + (let loop ((s s) > + (sanitizer* %unset-value) > + (serializer* %unset-value)) > + (syntax-case s (sanitizer serializer empty-serializer) > + (((sanitizer proc) tail ...) > + (if (maybe-value-set? sanitizer*) > + (syntax-violation 'sanitizer "duplicate entry" > + #'proc) > + (loop #'(tail ...) #'proc serializer*))) > + (((serializer proc) tail ...) > + (if (maybe-value-set? serializer*) > + (syntax-violation 'serializer "duplicate or conflicting ent= ry" > + #'proc) > + (loop #'(tail ...) sanitizer* #'proc))) > + ((empty-serializer tail ...) > + (if (maybe-value-set? serializer*) > + (syntax-violation 'empty-serializer > + "duplicate or conflicting entry" #f) > + (loop #'(tail ...) sanitizer* #'empty-serializer))) > + (() ; stop condition > + (values (list sanitizer* serializer*))) > + ((proc) ; TODO: deprecated, to be removed > + (every (cut eq? <> #f) > + (map maybe-value-set? > + (list sanitizer* serializer*))) This 'every' call result is not acted upon. Was it supposed to raise a syntax violation? If it's useful to keep it (and act on it), I'd use something like: --8<---------------cut here---------------start------------->8--- (unless (null? (filter-map maybe-value-set? (list sanitizer* serializer*))) (syntax-violation ...)) --8<---------------cut here---------------end--------------->8--- > + (begin I think the 'begin' is unnecessary. > + (warning #f (G_ "specifying serializers after documentation i= s \ > +deprecated, use (serializer ~a) instead~%") (syntax->datum #'proc)) I wonder, instead of #f, would it be possible to fill in the correct source location? That'd be useful, and it's done elsewhere, though I'm not too familiar with the mechanism (I think it relies on Guile's source properties). [...] > diff --git a/tests/services/configuration.scm b/tests/services/configurat= ion.scm > index 4f8a74dc8a..64b7bb1543 100644 > --- a/tests/services/configuration.scm > +++ b/tests/services/configuration.scm [...] > +(test-group "empty-serializer as literal/procedure tests" > + ;; empty-serializer as literal Nitpick; all stand-alone comments starting with ;; should be properly punctuated, complete sentences. The rest LGTM, but I'll leave it on the tracker for another week or so to allow for others to comment since it's a close-to-core change. --=20 Thanks, Maxim From unknown Fri Jun 20 07:19:24 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#62298] [PATCH v2 7/8] services: mpd: Use user-account (resp. user-group) for user (resp. group) fields. Resent-From: Maxim Cournoyer Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 24 Mar 2023 15:56:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 62298 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Bruno Victal Cc: 62298@debbugs.gnu.org, ludo@gnu.org, liliana.prikler@gmail.com Received: via spool by 62298-submit@debbugs.gnu.org id=B62298.167967335421621 (code B ref 62298); Fri, 24 Mar 2023 15:56:02 +0000 Received: (at 62298) by debbugs.gnu.org; 24 Mar 2023 15:55:54 +0000 Received: from localhost ([127.0.0.1]:41185 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pfjli-0005cf-8F for submit@debbugs.gnu.org; Fri, 24 Mar 2023 11:55:54 -0400 Received: from mail-vs1-f46.google.com ([209.85.217.46]:36529) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pfjld-0005cP-Dm for 62298@debbugs.gnu.org; Fri, 24 Mar 2023 11:55:53 -0400 Received: by mail-vs1-f46.google.com with SMTP id dc30so1371687vsb.3 for <62298@debbugs.gnu.org>; Fri, 24 Mar 2023 08:55:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679673334; h=mime-version:user-agent:message-id:in-reply-to:date:references :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=lyDuC44buCZGKN3Ar8lVgRSmiPfGtLdn0XY1gRdfkG4=; b=UwN6DgtsrAYcredyroX6vYyC2Zs5oJ4e77wi8H2swSw4l+tP8ViX96nzO3hyzESAux bNvG9Or0nyit8+TvAuP5wPfrdiw688EDRYZscKS1rmTnSv1CJwmLwrWNqB0g4l6z+TN5 iokKMxEuiPFpBvKGEUB7YV1vDffE60jLhfmjp3NzqT/5WaPVUl1PUUg/ggnrvtaJOceE MnZ+mUZyqpehL+AJG36fQOCmDUWJCjkfPF5loBEj8pNRESA7i2WG47rlo9SRAgjkjvEE Tghl9hf2EFGZx+l/V4JqhpbTB8tcW0jFALpq9FXHfl37AshVtbP8KoTZ1j3IeE2IqXNI Ofsw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679673334; h=mime-version:user-agent:message-id:in-reply-to:date:references :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=lyDuC44buCZGKN3Ar8lVgRSmiPfGtLdn0XY1gRdfkG4=; b=255KewGXmwfLP2vhpmRVygMMCeJ4fELxX6AtJ2j/Xml+hLBpBFlWFu+qZCkRM1Hdfd baUdoBm0kzhJ6pWs/W0MrvRkGACnWBx993uwjq53CsSA8BgClggoMjlDnz5n9gO3Y9VT S3mCo5jgjhkgz2oASH0cDv73p3vuaPyujaMnUeBZJ1cdnAR7bH6beN0SqLTFHqx+IyDc Ht8+vzNfbeAkl5Hpur6i/IzFqcKwNmK3Uot53RqVT0sI0xZhhniZNY8g4g9KU9GJTfdo OFFm7G0ygv8r5uaxAzEGh2ASnZkAAC7beAJJNtQT8uvWmCYmqmQdeJt5c8Pfk6jPEnxK oxng== X-Gm-Message-State: AAQBX9e41HpJVZIp4pfkgP9p4BUk+qkDj+K8HiQ22Wv9hM0MshyS3off 99YxsNnYKXaTFrTsuWHOAsQrhAUpAxha0g== X-Google-Smtp-Source: AKy350YyuaYiHyRUpqtAP66Xj3wgRyssjAUlkd9CGj/TrfNZTk1JWlXvyeaugbaMAucpkohifu3wcA== X-Received: by 2002:ad4:5c88:0:b0:5ad:47a1:1fd8 with SMTP id o8-20020ad45c88000000b005ad47a11fd8mr4511683qvh.50.1679671866968; Fri, 24 Mar 2023 08:31:06 -0700 (PDT) Received: from hurd (dsl-155-54.b2b2c.ca. [66.158.155.54]) by smtp.gmail.com with ESMTPSA id ob19-20020a0562142f9300b005dd8b9345ecsm760915qvb.132.2023.03.24.08.31.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Mar 2023 08:31:06 -0700 (PDT) From: Maxim Cournoyer References: Date: Fri, 24 Mar 2023 11:31:05 -0400 In-Reply-To: (Bruno Victal's message of "Thu, 23 Mar 2023 15:02:17 +0000") Message-ID: <87bkkiyxmu.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain 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 (-) Hello! Bruno Victal writes: > services: mpd: Use user-account (resp. user-group) for user (resp. group) fields. Please keep your git summary lines under 80 chars. > Deprecate using strings for these fields and prefer user-account (resp. user-group) > instead to avoid duplication within account-service-type. > If a string value is encountered, it is ignored and a predefined variable > is used instead. This is essentially a rollback to how it used to be before > '5c5f0fc1135ff15f9c4adfc5f27eadd9a592b5d1'. > > Fixes #61570 . > > * gnu/services/audio.scm (mpd-serialize-user-account, mpd-serialize-user-group) > (mpd-user-sanitizer, mpd-group-sanitizer): New procedure. > (%mpd-user, %mpd-group): New variable. > (mpd-configuration)[user, group]: Set value type to user-account (resp. user-group). > (mpd-shepherd-service): Adapt for user-account values in user field. > (mpd-accounts): Adapt for user-account (resp. user-group) in user (resp. group) field. Watch the 80 characters mark :-). Probably a good idea to configure your editor to automatically wrap lines at that mark. > > * doc/guix.texi (Audio Services): Update documentation. > --- > doc/guix.texi | 4 +- > gnu/services/audio.scm | 89 ++++++++++++++++++++++++++++++++++-------- > 2 files changed, 74 insertions(+), 19 deletions(-) > > diff --git a/doc/guix.texi b/doc/guix.texi > index af9f7d78c0..520a65b0b1 100644 > --- a/doc/guix.texi > +++ b/doc/guix.texi > @@ -33491,10 +33491,10 @@ Audio Services > @item @code{package} (default: @code{mpd}) (type: file-like) > The MPD package. > > -@item @code{user} (default: @code{"mpd"}) (type: string) > +@item @code{user} (type: maybe-user-account) > The user to run mpd as. > > -@item @code{group} (default: @code{"mpd"}) (type: string) > +@item @code{group} (type: maybe-user-group) > The group to run mpd as. > > @item @code{shepherd-requirement} (default: @code{()}) (type: list-of-symbol) > diff --git a/gnu/services/audio.scm b/gnu/services/audio.scm > index 198157a83b..c168d1481c 100644 > --- a/gnu/services/audio.scm > +++ b/gnu/services/audio.scm > @@ -140,6 +140,14 @@ (define (uglify-field-name field-name) > (define list-of-symbol? > (list-of symbol?)) > > +;; helpers for deprecated field types, to be removed later > +(define %lazy-group (make-symbol "%lazy-group")) > + > +(define (inject-group-into-user user group) > + (user-account > + (inherit user) > + (group (user-group-name group)))) nitpick: I'd prefer the plainer language 'set-user-group'. > > ;;; > ;;; MPD > @@ -164,9 +172,32 @@ (define mpd-serialize-boolean mpd-serialize-field) > (define (mpd-serialize-list-of-strings field-name value) > #~(string-append #$@(map (cut mpd-serialize-string field-name <>) value))) > > +(define (mpd-serialize-user-account field-name value) > + (mpd-serialize-string field-name (user-account-name value))) > + > +(define (mpd-serialize-user-group field-name value) > + (mpd-serialize-string field-name (user-group-name value))) > + > (define-maybe string (prefix mpd-)) > (define-maybe list-of-strings (prefix mpd-)) > (define-maybe boolean (prefix mpd-)) > +(define-maybe user-account (prefix mpd-)) > +(define-maybe user-group (prefix mpd-)) > + > +(define %mpd-user > + (user-account > + (name "mpd") > + (group "mpd") > + (system? #t) > + (comment "Music Player Daemon (MPD) user") > + ;; MPD can use $HOME (or $XDG_CONFIG_HOME) to place its data > + (home-directory "/var/lib/mpd") > + (shell (file-append shadow "/sbin/nologin")))) > + > +(define %mpd-group > + (user-group > + (name "mpd") > + (system? #t))) > > ;;; TODO: Procedures for deprecated fields, to be removed. > > @@ -197,6 +228,33 @@ (define (mpd-serialize-port field-name value) > > (define-maybe port (prefix mpd-)) > > +;;; procedures for unsupported value types, to be removed. Please make this a complete sentence, and clarify this is related to a deprecated usage? > +(define (mpd-user-sanitizer value) > + (cond ((user-account? value) value) > + ((string? value) > + (warning (G_ "string value for 'user' is deprecated, use \ > +user-account instead~%")) > + (user-account > + (inherit %mpd-user) > + (name value) > + ;; XXX: this is to be lazily substituted in (mpd-accounts) > + ;; with the value from 'group'. Nitpick: XXX: This (with capitalized first letter), and no hanging indent for continued line. > + (group %lazy-group))) > + (else > + (configuration-field-error #f 'user value)))) > + > +(define (mpd-group-sanitizer value) > + (cond ((user-group? value) value) > + ((string? value) > + (warning (G_ "string value for 'group' is deprecated, use \ > +user-group instead~%")) > + (user-group > + (inherit %mpd-group) > + (name value))) > + (else > + (configuration-field-error #f 'group value)))) > + > ;;; > > ;; Generic MPD plugin record, lists only the most prevalent fields. > @@ -347,12 +405,14 @@ (define-configuration mpd-configuration > empty-serializer) > > (user > - (string "mpd") > - "The user to run mpd as.") > + (maybe-user-account %mpd-user) > + "The user to run mpd as." > + (sanitizer mpd-user-sanitizer)) > > (group > - (string "mpd") > - "The group to run mpd as.") > + (maybe-user-group %mpd-group) > + "The group to run mpd as." > + (sanitizer mpd-group-sanitizer)) > > (shepherd-requirement > (list-of-symbol '()) > @@ -516,7 +576,8 @@ (define (mpd-shepherd-service config) > log-file playlist-directory > db-file state-file sticker-file > environment-variables) > - (let* ((config-file (mpd-serialize-configuration config))) > + (let ((config-file (mpd-serialize-configuration config)) > + (username (user-account-name user))) > (shepherd-service > (documentation "Run the MPD (Music Player Daemon)") > (requirement `(user-processes loopback ,@shepherd-requirement)) > @@ -525,7 +586,7 @@ (define (mpd-shepherd-service config) > (and=> #$(maybe-value log-file) > (compose mkdir-p dirname)) > > - (let ((user (getpw #$user))) > + (let ((user (getpw #$username))) > (for-each > (lambda (x) > (when (and x (not (file-exists? x))) > @@ -559,17 +620,11 @@ (define (mpd-shepherd-service config) > > (define (mpd-accounts config) > (match-record config (user group) > - (list (user-group > - (name group) > - (system? #t)) > - (user-account > - (name user) > - (group group) > - (system? #t) > - (comment "Music Player Daemon (MPD) user") > - ;; MPD can use $HOME (or $XDG_CONFIG_HOME) to place its data > - (home-directory "/var/lib/mpd") > - (shell (file-append shadow "/sbin/nologin")))))) > + ;; TODO: deprecation code, to be removed nitpick: Please use a complete sentence for this stand-alone comment. > + (let ((user (if (eq? (user-account-group user) %lazy-group) > + (inject-group-into-user user group) > + user))) > + (list user group)))) > > (define mpd-service-type > (service-type The rest LGTM, with consideration to Liliana's remarks. -- Thanks, Maxim From unknown Fri Jun 20 07:19:24 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#62298] [PATCH v2 8/8] services: mympd: Use user-account (resp. user-group) for user (resp. group) fields. Resent-From: Maxim Cournoyer Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 24 Mar 2023 16:04:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 62298 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Bruno Victal Cc: 62298@debbugs.gnu.org, ludo@gnu.org, liliana.prikler@gmail.com Received: via spool by 62298-submit@debbugs.gnu.org id=B62298.167967380222488 (code B ref 62298); Fri, 24 Mar 2023 16:04:01 +0000 Received: (at 62298) by debbugs.gnu.org; 24 Mar 2023 16:03:22 +0000 Received: from localhost ([127.0.0.1]:41205 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pfjss-0005qa-33 for submit@debbugs.gnu.org; Fri, 24 Mar 2023 12:03:21 -0400 Received: from mail-qt1-f173.google.com ([209.85.160.173]:36739) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pfjsq-0005qN-5m for 62298@debbugs.gnu.org; Fri, 24 Mar 2023 12:03:16 -0400 Received: by mail-qt1-f173.google.com with SMTP id hf2so1890121qtb.3 for <62298@debbugs.gnu.org>; Fri, 24 Mar 2023 09:03:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679673790; h=content-transfer-encoding:mime-version:user-agent:message-id :in-reply-to:date:references:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to; bh=Q3alAuJfWnKloZRjRD7/Bi2OLxmgfPyRaFvT0nN9RBc=; b=gtPYyi+Rcsdd5vu2iW1V+siSCw6rLwqFCN8IPRusMO55WFzN5bkHHJbf0av21Lz3YB 5hkNjc0bos2fcBAn4/ARv03ATJNMnKeShO7C2gQNNJtJtLaxgSXlvpQnVzE1UjgJF5IY dUgEDI54EyvpDxCwzL3mkHiv68CiECV+djskRa5IEX5WH/9A6rfCQfUP/qMQVJYiq/CG ouVTgFLnqgw6ERyRZuOyzm1iZv6ZBgy0lyKkROhboVysRcuTjpR30PzNTXZuOb/pdFaR z4qQDjRYdSeviEnIuOtt0ymOBjwuvanLu3O1b9JrS2RZzXZYzI+JlNd/9Ri9jXsLnv9r RJbg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679673790; h=content-transfer-encoding:mime-version:user-agent:message-id :in-reply-to:date:references:subject:cc:to:from:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=Q3alAuJfWnKloZRjRD7/Bi2OLxmgfPyRaFvT0nN9RBc=; b=mQvxM5JeoQvrBoNO33d/wd6MY2prtjNc6jPF2OMxVo3DvEBXPlBwYycQyD+lIbrkMT 8oqfBnjvj+EmRkIxNEIh5l0Gtm0qAHFnzWCmSeHprJt9TgmDzdBxpnUySVhOdu7vuAs8 0+mEzoDcWKgbKoRPkK5b+DeAwRMIy3VulKT5l6Yz9a8SYIV2LfVE9R9VCYcygH6qkQp4 67Bu37t3kw3yz9ywwQlPYnzpoueg5hvkRbLwyyQEwBrymR5G46zodymJjYdY5gYJZ4aI GcySV2KnRK5bJHLtHx+PklKB3TK1lkGTCySiSFHqHjghJGvhJVarEhHFd2rcxaaJcSsB LiSg== X-Gm-Message-State: AO0yUKVh0mLqbXrD66g7uhzClG7rplmLHuaFuWr2GFXYZeUWsNJVSUFT mf21CJtGhaFTGYTn6mWgUZQ= X-Google-Smtp-Source: AK7set9KeSjCLmyzLdly1hUIVW6kCJPhDSVYxTd36bYGlWQNnc5JMgp7B+xI4iGCHrkAtA72YJvLRw== X-Received: by 2002:a05:622a:454:b0:3b8:6a92:c8d6 with SMTP id o20-20020a05622a045400b003b86a92c8d6mr5089824qtx.60.1679673790508; Fri, 24 Mar 2023 09:03:10 -0700 (PDT) Received: from hurd (dsl-155-54.b2b2c.ca. [66.158.155.54]) by smtp.gmail.com with ESMTPSA id 196-20020a370acd000000b0074690b42617sm7814921qkk.15.2023.03.24.09.03.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Mar 2023 09:03:10 -0700 (PDT) From: Maxim Cournoyer References: <364a2fe961ddce2c4668c0c8b78f46bffe2c2096.1679583701.git.mirai@makinata.eu> Date: Fri, 24 Mar 2023 12:03:09 -0400 In-Reply-To: <364a2fe961ddce2c4668c0c8b78f46bffe2c2096.1679583701.git.mirai@makinata.eu> (Bruno Victal's message of "Thu, 23 Mar 2023 15:02:18 +0000") Message-ID: <877cv6yw5e.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) 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: -1.0 (-) Hello, Bruno Victal writes: > services: mympd: Use user-account (resp. user-group) for user (resp. grou= p) fields. > > * gnu/services/audio.scm (%mympd-user, %mympd-group): New variable. > (mympd-user-sanitizer, mympd-group-sanitizer): New procedure. > (mympd-configuration)[user, group]: Set value type to user-account (resp.= user-group). > (mympd-serialize-configuration): Adapt for user-account values in user fi= eld. > (mympd-accounts): Adapt for user-account (resp. user-group) in user (resp= . group) field. Please configure your editor for the 80 characters mark. > --- > doc/guix.texi | 4 +-- > gnu/services/audio.scm | 74 ++++++++++++++++++++++++++++++++++-------- > 2 files changed, 63 insertions(+), 15 deletions(-) > > diff --git a/doc/guix.texi b/doc/guix.texi > index 520a65b0b1..ee1e66b3ff 100644 > --- a/doc/guix.texi > +++ b/doc/guix.texi > @@ -33732,10 +33732,10 @@ Audio Services > This is a list of symbols naming Shepherd services that this service > will depend on. >=20=20 > -@item @code{user} (default: @code{"mympd"}) (type: string) > +@item @code{user} (type: maybe-user-account) > Owner of the @command{mympd} process. >=20=20 > -@item @code{group} (default: @code{"nogroup"}) (type: string) > +@item @code{group} (type: maybe-user-group) > Owner group of the @command{mympd} process. >=20=20 > @item @code{work-directory} (default: @code{"/var/lib/mympd"}) (type: st= ring) > diff --git a/gnu/services/audio.scm b/gnu/services/audio.scm > index c168d1481c..f7f430039e 100644 > --- a/gnu/services/audio.scm > +++ b/gnu/services/audio.scm > @@ -659,6 +659,54 @@ (define-configuration/no-serialization mympd-ip-acl > (define-maybe/no-serialization integer) > (define-maybe/no-serialization mympd-ip-acl) >=20=20 > +;; XXX: These will shadow the previous definition used by mpd > +;; and cause warnings to be shown. Maybe split the file > +;; into audio/mpd.scm and audio/mympd.scm ? > +#;(define-maybe/no-serialization user-account) > +#;(define-maybe/no-serialization user-group) I'd rather keeping them together if possible; could the prefix trick be used with them? No need for a hanging indent for continued text, here and for the other occurrences. The expressions commented; should they be? On another note, '#;' appears undocumented, I'd avoid it until it is (and it's not necessary here). > +(define %mympd-user > + (user-account > + (name "mympd") > + (group "mympd") > + (system? #t) > + (comment "myMPD user") > + (home-directory "/var/empty") > + (shell (file-append shadow "/sbin/nologin")))) > + > +(define %mympd-group > + (user-group > + (name "mympd") > + (system? #t))) > + > +;;; TODO: procedures for unsupported value types, to be removed. ^ Procedures =20=20=20=20=20=20=20=20=20=20=20=20=20 > +(define (mympd-user-sanitizer value) > + (cond ((user-account? value) value) > + ((string? value) > + (warning (G_ "string value for 'user' is not supported, use \ > +user-account instead~%")) > + (user-account > + (inherit %mympd-user) > + (name value) > + ;; XXX: this is to be lazily substituted in (=E2=80=A6-account= s) > + ;; with the value from 'group'. Extraneous hanging indent :-). > + (group %lazy-group))) > + (else > + (configuration-field-error #f 'user value)))) > + > +(define (mympd-group-sanitizer value) > + (cond ((user-group? value) value) > + ((string? value) > + (warning (G_ "string value for 'group' is not supported, use \ > +user-group instead~%")) > + (user-group > + (inherit %mympd-group) > + (name value))) > + (else > + (configuration-field-error #f 'group value)))) > +;;; Was this ';;;' added by mistake? > ;; XXX: The serialization procedures are insufficient since we require > ;; access to multiple fields at once. > ;; Fields marked with empty-serializer are never serialized and are > @@ -676,13 +724,15 @@ (define-configuration/no-serialization mympd-config= uration > empty-serializer) >=20=20 > (user > - (string "mympd") > + (maybe-user-account %mympd-user) > "Owner of the @command{mympd} process." > + (sanitizer mympd-user-sanitizer) > empty-serializer) >=20=20 > (group > - (string "nogroup") > + (maybe-user-group %mympd-group) > "Owner group of the @command{mympd} process." > + (sanitizer mympd-group-sanitizer) > empty-serializer) >=20=20 > (work-directory > @@ -817,7 +867,8 @@ (define (mympd-shepherd-service config) > (match-record config (package shepherd-requireme= nt > user work-directory > cache-directory log-level = log-to) > - (let ((log-level* (format #f "MYMPD_LOGLEVEL=3D~a" log-level))) > + (let ((log-level* (format #f "MYMPD_LOGLEVEL=3D~a" log-level)) > + (username (user-account-name user))) > (shepherd-service > (documentation "Run the myMPD daemon.") > (requirement `(loopback user-processes > @@ -825,7 +876,7 @@ (define (mympd-shepherd-service config) > ,@shepherd-requirement)) > (provision '(mympd)) > (start #~(begin > - (let* ((pw (getpwnam #$user)) > + (let* ((pw (getpwnam #$username)) > (uid (passwd:uid pw)) > (gid (passwd:gid pw))) > (for-each (lambda (dir) > @@ -835,7 +886,7 @@ (define (mympd-shepherd-service config) >=20=20 > (make-forkexec-constructor > `(#$(file-append package "/bin/mympd") > - "--user" #$user > + "--user" #$username > #$@(if (eqv? log-to 'syslog) '("--syslog") '()) > "--workdir" #$work-directory > "--cachedir" #$cache-directory) > @@ -845,14 +896,11 @@ (define (mympd-shepherd-service config) >=20=20 > (define (mympd-accounts config) > (match-record config (user group) > - (list (user-group (name group) > - (system? #t)) > - (user-account (name user) > - (group group) > - (system? #t) > - (comment "myMPD user") > - (home-directory "/var/empty") > - (shell (file-append shadow "/sbin/no= login")))))) > + ;; TODO: deprecation code, to be removed Please use a full sentence. > + (let ((user (if (eq? (user-account-group user) %lazy-group) > + (inject-group-into-user user group) > + user))) > + (list user group)))) >=20=20 > (define (mympd-log-rotation config) > (match-record config (log-to) LGTM, with the comments from Liliana taken into account. --=20 Thanks, Maxim From unknown Fri Jun 20 07:19:24 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#62298] [PATCH v2 1/8] services: configuration: Add user-defined sanitizer support. Resent-From: Liliana Marie Prikler Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 24 Mar 2023 18:04:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 62298 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Maxim Cournoyer , Bruno Victal Cc: 62298@debbugs.gnu.org, ludo@gnu.org Received: via spool by 62298-submit@debbugs.gnu.org id=B62298.16796809952457 (code B ref 62298); Fri, 24 Mar 2023 18:04:02 +0000 Received: (at 62298) by debbugs.gnu.org; 24 Mar 2023 18:03:15 +0000 Received: from localhost ([127.0.0.1]:41318 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pflkw-0000dZ-Vh for submit@debbugs.gnu.org; Fri, 24 Mar 2023 14:03:15 -0400 Received: from mail-ed1-f67.google.com ([209.85.208.67]:43817) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pflkv-0000dL-GB for 62298@debbugs.gnu.org; Fri, 24 Mar 2023 14:03:13 -0400 Received: by mail-ed1-f67.google.com with SMTP id x3so11038014edb.10 for <62298@debbugs.gnu.org>; Fri, 24 Mar 2023 11:03:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679680988; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:from:to:cc:subject :date:message-id:reply-to; bh=5gPHUZOukGuPxP/3q9CgsD4Uql9IEMR4n76oFknpfLw=; b=Jq0v5Zb0mQYDy0BDxR4un9+efh4WDXOQ7x258gRfACxkQhHu48DKLbyfSEL7Ox2+55 T0bImrKxXgZY9s68KaK8ulTWPoouvVy8b9+ZYdqTLXCYlfm1CRQXp+ftLO94pJ3n5dw0 /EQJllJmeHY2CV01umNmlHO31wL4RmE3xdzCRccGaBnZTt5+c94b+ux4klwO32RWNT5p xbN/unRvMBQnms+jb0N112jj5lkelf+8ysKA/d7NlR1dGF+lc5zZ9mtQzdAb5SqYWcea wUa6lHQF2Li6OtOoFQBUbxI1lhYxkHage4IDXQjA9+hvqTLfN7HYq5mlQdnKvExO2huL MYSw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679680988; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=5gPHUZOukGuPxP/3q9CgsD4Uql9IEMR4n76oFknpfLw=; b=tD6MVQTsugsPx9CADYwCEyF9wSnEBoK9OK26ELgJqSd+psvZZ56vbI78nXl8nwMq1h 2ACp7cHxaZrKZn7/xIlHagpqo1vLTzlp09UAvmMRTGW2XAVyp1eImvPh8uku9f42uBJP CxPhffxTa4kTRMbbW/dD3CS4FxRZd8zI/WYVNu346tru2HnUD5LSYYx9oiQvFe5GHl46 0DoQidtIIog0cgpvhu6cSc0haVL5kyHhaZR3LSTUVR2WqTeBqMyypOryADdgSjO8wQF+ v65cTOlIkaHvC8pc6gOayKSJcJBUixGWPPXRzFxI3uq8PP2MypYIRaTPQWsKsV31SsyD ccEA== X-Gm-Message-State: AAQBX9dK1iZ9Vd2WREo2fzFrwPegObMYwnTrImqOBPRvwoHmo2zRwQVl 25CFyBIo0pCvSvS9iOT2Ji4= X-Google-Smtp-Source: AKy350be9KrNQo5XGud8oFZF4GtXnLU80xKqQjtMCTZ2YOhQQA4GyKGIOZLRG06mIPnX++aTEE+G2g== X-Received: by 2002:a17:906:5acf:b0:8b1:7684:dfab with SMTP id x15-20020a1709065acf00b008b17684dfabmr4475503ejs.38.1679680987769; Fri, 24 Mar 2023 11:03:07 -0700 (PDT) Received: from lumine.fritz.box (85-127-52-93.dsl.dynamic.surfer.at. [85.127.52.93]) by smtp.gmail.com with ESMTPSA id u22-20020a50d516000000b004ad601533a3sm11209149edi.55.2023.03.24.11.03.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Mar 2023 11:03:07 -0700 (PDT) Message-ID: <90309cae7dc850a2008ddc67a797cb4ff4b3cb97.camel@gmail.com> From: Liliana Marie Prikler Date: Fri, 24 Mar 2023 19:03:06 +0100 In-Reply-To: <87r0tez0ny.fsf@gmail.com> References: <87r0tez0ny.fsf@gmail.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.46.0 MIME-Version: 1.0 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 (-) Am Freitag, dem 24.03.2023 um 10:25 -0400 schrieb Maxim Cournoyer: > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ((proc)=C2=A0 ; TODO: depre= cated, to be removed > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (every (cut eq? <> #f= ) > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0 (map maybe-value-set? > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (list sanitizer* serial= izer*))) >=20 > This 'every' call result is not acted upon.=C2=A0 Was it supposed to rais= e > a syntax violation?=C2=A0 If it's useful to keep it (and act on it), I'd > use something like: If I read this correctly, this 'every' call is actually in a guard position, that is the syntax-case will ignore proc unless=20 > --8<---------------cut here---------------start------------->8--- > (null? (filter-map maybe-value-set? (list sanitizer* serializer*))) > --8<---------------cut here---------------end--------------->8--- I think your guard is the fancier one, though, and should be preferred. >=20 Cheers From unknown Fri Jun 20 07:19:24 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: Bruno Victal Subject: bug#62298: closed (Re: [PATCH v2 6/8] services: mpd: Set PulseAudio related variables as default value for environment-variables field.) Message-ID: References: <87r0texbo9.fsf@gmail.com> X-Gnu-PR-Message: they-closed 62298 X-Gnu-PR-Package: guix-patches X-Gnu-PR-Keywords: patch Reply-To: 62298@debbugs.gnu.org Date: Fri, 24 Mar 2023 18:11:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1679681462-3284-1" This is a multi-part message in MIME format... ------------=_1679681462-3284-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #62298: [PATCH 0/8] Extensible define-configuration & mpd/mympd service fix= es 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 62298@debbugs.gnu.org. --=20 62298: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D62298 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1679681462-3284-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 62298-done) by debbugs.gnu.org; 24 Mar 2023 18:10:56 +0000 Received: from localhost ([127.0.0.1]:41323 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pflsN-0000qh-Qt for submit@debbugs.gnu.org; Fri, 24 Mar 2023 14:10:56 -0400 Received: from mail-qt1-f173.google.com ([209.85.160.173]:44877) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pflsL-0000qR-9B for 62298-done@debbugs.gnu.org; Fri, 24 Mar 2023 14:10:53 -0400 Received: by mail-qt1-f173.google.com with SMTP id s12so2224888qtq.11 for <62298-done@debbugs.gnu.org>; Fri, 24 Mar 2023 11:10:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679681447; h=mime-version:user-agent:message-id:in-reply-to:date:references :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=YIYSyeRjDOFuEOGdpJjzmTSMgUi8wtrcjgShnk5tHmI=; b=G2WR/8+R4B6HSd1sU5tibogfLV+5SRo+5MGtHWjj7+r0JXjGaYUkWn8rpZXRAQekcw vx2Myi6TAbRbECL6bhsAPKPIDF7QpdzucPqyIUr5K1CASDY+EcG4Pe22r3Zmz9HVUWWB eMdDj/zv8edBwm9YZOZDMHCz48ECYiv4myk/eCl9uJ+op9O1qUqxuERf5GPvQdVlztyA uevTctykb4NxEzPq922EGOvvhr+6Wc8oYbCefUm4H/kEmfovIHCQJybqY8ytocf/vISZ 1QLnyMh3H34DCAPqahJAB7WMTmE83IJ0IDA/IBBmhPZ++1QS5xz/Sxl+5cVfb3cqUNpW FOmg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679681447; h=mime-version:user-agent:message-id:in-reply-to:date:references :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=YIYSyeRjDOFuEOGdpJjzmTSMgUi8wtrcjgShnk5tHmI=; b=VLAeN9DAem8YrgUt3/3rgZ+eWOZBSnD56Ic0s6EfRoYEsK/Uv+r9n/GBeR3IALxZEH 1HgqqacvQy29ItAK4NcX1IWHOCI2USvD4B6TgPjkpsKUriU/WQXS0+O0xSDIIUu6+RqX hwMtMhP1GUf0CvWDnbD1VVaZssLMhoaFUUn1+XpoFdZfYH4X91qkVtdCpDECx52Psiqw LD2xkSxFfqbObtYhZoWaTM9qphVy5UF0P4aN3KuyXxu6y4AaYMqIGlFSOUWMgjz11TzE Km3rkw80KamIvUzEHvm3h+ibl7MN1qhNY9qwYKzU+h2rCaEi69F3vqa/X7l1g6Wdo2pj jgkw== X-Gm-Message-State: AO0yUKUpWGJ6BVJ7vY2/N34Fr/Z4O96qi13alyEKXxhHhEGR42xe5APS Wl0MrSCiKPtUn/SdtCsWeEk= X-Google-Smtp-Source: AK7set9txxs/yGwKQXN7WFdZw1MWJ4lPgtEGaxObUac1XoX1O6+j1C1k+NtAtKCnXOthMULvabV2hg== X-Received: by 2002:ac8:4e42:0:b0:3df:8602:b45c with SMTP id e2-20020ac84e42000000b003df8602b45cmr18396138qtw.17.1679681447642; Fri, 24 Mar 2023 11:10:47 -0700 (PDT) Received: from hurd (dsl-155-54.b2b2c.ca. [66.158.155.54]) by smtp.gmail.com with ESMTPSA id c23-20020a379a17000000b007436d0e9408sm9424027qke.127.2023.03.24.11.10.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Mar 2023 11:10:47 -0700 (PDT) From: Maxim Cournoyer To: Bruno Victal Subject: Re: [PATCH v2 6/8] services: mpd: Set PulseAudio related variables as default value for environment-variables field. References: <1fd17a12b40197d1a9d1de8f1d762c86649c7a0a.1679583701.git.mirai@makinata.eu> Date: Fri, 24 Mar 2023 14:10:46 -0400 In-Reply-To: <1fd17a12b40197d1a9d1de8f1d762c86649c7a0a.1679583701.git.mirai@makinata.eu> (Bruno Victal's message of "Thu, 23 Mar 2023 15:02:16 +0000") Message-ID: <87r0texbo9.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 62298-done Cc: 62298-done@debbugs.gnu.org, ludo@gnu.org, liliana.prikler@gmail.com 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 (-) Hi, Bruno Victal writes: > These variables are necessary for PulseAudio to work properly out-of-the-box > for 'non-interactive' users. > * doc/guix.texi (Audio Services): Update environment-variables field description for > mpd-configuration data type. > * gnu/services/audio.scm (mpd-configuration)[environment-variables]: Set > PULSE_CLIENTCONFIG and PULSE_CONFIG environment variables to the system-wide > PulseAudio configuration. > --- > doc/guix.texi | 2 +- > gnu/services/audio.scm | 3 ++- > 2 files changed, 3 insertions(+), 2 deletions(-) > > diff --git a/doc/guix.texi b/doc/guix.texi > index 2b62605b51..af9f7d78c0 100644 > --- a/doc/guix.texi > +++ b/doc/guix.texi > @@ -33501,7 +33501,7 @@ Audio Services > This is a list of symbols naming Shepherd services that this service > will depend on. > > -@item @code{environment-variables} (default: @code{()}) (type: list-of-strings) > +@item @code{environment-variables} (default: @code{("PULSE_CLIENTCONFIG=/etc/pulse/client.conf" "PULSE_CONFIG=/etc/pulse/daemon.conf")}) (type: list-of-strings) > A list of strings specifying environment variables. > > @item @code{log-file} (default: @code{"/var/log/mpd/log"}) (type: maybe-string) > diff --git a/gnu/services/audio.scm b/gnu/services/audio.scm > index 56ea2f8638..198157a83b 100644 > --- a/gnu/services/audio.scm > +++ b/gnu/services/audio.scm > @@ -361,7 +361,8 @@ (define-configuration mpd-configuration > empty-serializer) > > (environment-variables > - (list-of-strings '()) > + (list-of-strings '("PULSE_CLIENTCONFIG=/etc/pulse/client.conf" > + "PULSE_CONFIG=/etc/pulse/daemon.conf")) > "A list of strings specifying environment variables." > empty-serializer) Installed, thank you! -- Thanks, Maxim ------------=_1679681462-3284-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 20 Mar 2023 16:46:18 +0000 Received: from localhost ([127.0.0.1]:55594 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1peIeI-0002M6-20 for submit@debbugs.gnu.org; Mon, 20 Mar 2023 12:46:18 -0400 Received: from lists.gnu.org ([209.51.188.17]:51044) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1peIeG-0002Lw-LL for submit@debbugs.gnu.org; Mon, 20 Mar 2023 12:46:16 -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 1peIeG-0000Zq-DJ for guix-patches@gnu.org; Mon, 20 Mar 2023 12:46:16 -0400 Received: from smtpmciv3.myservices.hosting ([185.26.107.239]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1peIe9-0006xf-KT for guix-patches@gnu.org; Mon, 20 Mar 2023 12:46:16 -0400 Received: from mail1.netim.hosting (unknown [185.26.106.173]) by smtpmciv3.myservices.hosting (Postfix) with ESMTP id BA0CB20407 for ; Mon, 20 Mar 2023 17:45:58 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by mail1.netim.hosting (Postfix) with ESMTP id 682B280098; Mon, 20 Mar 2023 17:45:58 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at mail1.netim.hosting Received: from mail1.netim.hosting ([127.0.0.1]) by localhost (mail1-2.netim.hosting [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id 3PYLzLgXaX8n; Mon, 20 Mar 2023 17:45:56 +0100 (CET) Received: from guix-nuc.home.arpa (bl9-119-177.dsl.telepac.pt [85.242.119.177]) (Authenticated sender: lumen@makinata.eu) by mail1.netim.hosting (Postfix) with ESMTPSA id 37C8280079; Mon, 20 Mar 2023 17:45:56 +0100 (CET) From: Bruno Victal To: guix-patches@gnu.org Subject: [PATCH 0/8] Extensible define-configuration & mpd/mympd service fixes Date: Mon, 20 Mar 2023 16:45:47 +0000 Message-Id: X-Mailer: git-send-email 2.39.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Debbugs-CC: liliana.prikler@gmail.com, maxim.cournoyer@gmail.com, ludo@gnu.org Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=185.26.107.239; envelope-from=mirai@makinata.eu; helo=smtpmciv3.myservices.hosting X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.3 (-) X-Debbugs-Envelope-To: submit Cc: Bruno Victal 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.3 (--) Highlights: * Make define-configuration extensible. define-configuration can now have extra fields where custom-serializer was located. * New literals: sanitizer, serializer. Support user-specified sanitizers. * Fixes . * Switch to user-account/group for mympd-service-type as well. * Make mpd-service-type with pulseaudio usable out-of-the-box. * Fix a mympd-service-type when logging with syslog. Bruno Victal (8): services: configuration: Add user-defined sanitizer support. services: replace bare serializers with (serializer ...) services: audio: remove redundant list-of-string? predicate. services: mympd: Require 'syslog service when configured to log to syslog. services: mpd: Fix unintentional API breakage for mixer-type field. services: mpd: Set PulseAudio related variables as default value for environment-variables field. services: mpd: Use user-account (resp. user-group) for user (resp. group) fields. services: mympd: Use user-account (resp. user-group) for user (resp. group) fields. doc/guix.texi | 46 +++++-- gnu/home/services/shells.scm | 12 +- gnu/services/audio.scm | 224 ++++++++++++++++++++++--------- gnu/services/configuration.scm | 97 ++++++++++--- gnu/services/security.scm | 6 +- tests/services/configuration.scm | 156 ++++++++++++++++++++- 6 files changed, 431 insertions(+), 110 deletions(-) -- 2.39.1 ------------=_1679681462-3284-1-- From unknown Fri Jun 20 07:19:24 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#62298] [PATCH v2 8/8] services: mympd: Use user-account (resp. user-group) for user (resp. group) fields. Resent-From: Bruno Victal Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 25 Mar 2023 00:34:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 62298 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Maxim Cournoyer Cc: 62298@debbugs.gnu.org, ludo@gnu.org, liliana.prikler@gmail.com Received: via spool by 62298-submit@debbugs.gnu.org id=B62298.167970441929901 (code B ref 62298); Sat, 25 Mar 2023 00:34:02 +0000 Received: (at 62298) by debbugs.gnu.org; 25 Mar 2023 00:33:39 +0000 Received: from localhost ([127.0.0.1]:41750 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pfrqk-0007mD-Ls for submit@debbugs.gnu.org; Fri, 24 Mar 2023 20:33:39 -0400 Received: from smtpm4.myservices.hosting ([185.26.105.235]:47012) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pfrqi-0007m3-FF for 62298@debbugs.gnu.org; Fri, 24 Mar 2023 20:33:37 -0400 Received: from mail1.netim.hosting (unknown [185.26.106.173]) by smtpm4.myservices.hosting (Postfix) with ESMTP id 4847D20D97; Sat, 25 Mar 2023 01:33:32 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by mail1.netim.hosting (Postfix) with ESMTP id DA69680098; Sat, 25 Mar 2023 01:33:31 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at mail1.netim.hosting Received: from mail1.netim.hosting ([127.0.0.1]) by localhost (mail1-2.netim.hosting [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id WUPp7DoqKnQg; Sat, 25 Mar 2023 01:33:31 +0100 (CET) Received: from [192.168.1.239] (unknown [10.192.1.83]) (Authenticated sender: lumen@makinata.eu) by mail1.netim.hosting (Postfix) with ESMTPSA id 32F9480097; Sat, 25 Mar 2023 01:33:31 +0100 (CET) Message-ID: <6adedff0-30d3-c1c4-7b10-ece811f517ab@makinata.eu> Date: Sat, 25 Mar 2023 00:33:30 +0000 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.8.0 Content-Language: en-US References: <364a2fe961ddce2c4668c0c8b78f46bffe2c2096.1679583701.git.mirai@makinata.eu> <877cv6yw5e.fsf@gmail.com> From: Bruno Victal In-Reply-To: <877cv6yw5e.fsf@gmail.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -1.1 (-) 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.1 (--) On 2023-03-24 16:03, Maxim Cournoyer wrote:> Bruno Victal writes: >> >> +;; XXX: These will shadow the previous definition used by mpd >> +;; and cause warnings to be shown. Maybe split the file >> +;; into audio/mpd.scm and audio/mympd.scm ? >> +#;(define-maybe/no-serialization user-account) >> +#;(define-maybe/no-serialization user-group) > > I'd rather keeping them together if possible; could the prefix trick be > used with them? No need for a hanging indent for continued text, here > and for the other occurrences. The prefix trick is unlikely to help since the previous ones already use it. --8<---------------cut here---------------start------------->8--- (define-maybe user-account (prefix mpd-)) (define-maybe user-group (prefix mpd-)) --8<---------------cut here---------------end--------------->8--- I'm using define-maybe as a “cheat” here for prettier documentation generation. Without define-maybe, the documentation is rendered as: --8<---------------cut here---------------start------------->8--- @item @code{user} (type: user-account) The user to run mpd as. --8<---------------cut here---------------end--------------->8--- … which is the documentation format for a field that requires an explicit value, even though we are setting a default one using %mpd-account. On the other hand, using define-maybe yields: --8<---------------cut here---------------start------------->8--- @item @code{user} (type: maybe-user-account) The user to run mpd as. --8<---------------cut here---------------end--------------->8--- … which is the format for fields that do not require any manual intervention. > The expressions commented; should they be? On another note, '#;' > appears undocumented, I'd avoid it until it is (and it's not necessary > here). They're commented because the “right way of things” would have that the first maybe-user-account is mpd-configuration specific due to (prefix mpd-) and that we should have another maybe-user-account that is unrelated. Here, we're actually reusing the one from mpd and it happens to be “ok” since we do no serialization due to define-configuration/no-serialization. Regarding #;, it is documented, though perhaps in a indirect manner. It's SRFI-62, which is listed as supported in Guile manual. >> + (inherit %mympd-group) >> + (name value))) >> + (else >> + (configuration-field-error #f 'group value)))) >> +;;; > > Was this ';;;' added by mistake? It serves as an aid to demarcate the deprecation helpers to be erased when the time arrives. The helpers for MPD are also similarly demarcated. From unknown Fri Jun 20 07:19:24 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#62298] [PATCH v3 1/5] services: configuration: Add user-defined sanitizer support. References: In-Reply-To: Resent-From: Bruno Victal Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 25 Mar 2023 00:48:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 62298 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 62298@debbugs.gnu.org Cc: ludo@gnu.org, Bruno Victal , liliana.prikler@gmail.com, maxim.cournoyer@gmail.com Received: via spool by 62298-submit@debbugs.gnu.org id=B62298.167970522931060 (code B ref 62298); Sat, 25 Mar 2023 00:48:02 +0000 Received: (at 62298) by debbugs.gnu.org; 25 Mar 2023 00:47:09 +0000 Received: from localhost ([127.0.0.1]:41758 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pfs3o-00084s-5H for submit@debbugs.gnu.org; Fri, 24 Mar 2023 20:47:09 -0400 Received: from smtpmciv4.myservices.hosting ([185.26.107.240]:51052) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pfs3l-00084j-Bs for 62298@debbugs.gnu.org; Fri, 24 Mar 2023 20:47:06 -0400 Received: from mail1.netim.hosting (unknown [185.26.106.173]) by smtpmciv4.myservices.hosting (Postfix) with ESMTP id 909CD20820; Sat, 25 Mar 2023 01:47:03 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by mail1.netim.hosting (Postfix) with ESMTP id 316FF8009C; Sat, 25 Mar 2023 01:47:03 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at mail1.netim.hosting Received: from mail1.netim.hosting ([127.0.0.1]) by localhost (mail1-2.netim.hosting [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id 3O8FTV5fqF86; Sat, 25 Mar 2023 01:47:01 +0100 (CET) Received: from guix-nuc.home.arpa (bl9-119-177.dsl.telepac.pt [85.242.119.177]) (Authenticated sender: lumen@makinata.eu) by mail1.netim.hosting (Postfix) with ESMTPSA id 8143C80097; Sat, 25 Mar 2023 01:47:01 +0100 (CET) From: Bruno Victal Date: Sat, 25 Mar 2023 00:46:44 +0000 Message-Id: X-Mailer: git-send-email 2.39.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 (-) This changes the 'custom-serializer' field into a generic 'extra-args' field that can be extended to support new literals. With this mechanism, the literals 'sanitizer' allow for user-defined sanitizer procedures while the 'serializer' literal is used for custom serializer procedures. The 'empty-serializer' was also added as a 'literal' and can be used just like it was previously. With the repurposing of 'custom-serializer' into 'extra-args', to prevent intolerable confusion, the custom serializer procedures should be specified using the new 'literals' approach, with the previous “style” being considered deprecated. * gnu/services/configuration.scm (define-configuration-helper): Rename 'custom-serializer' to 'extra-args'. Add support for literals 'sanitizer', 'serializer' and 'empty-serializer'. Rename procedure 'field-sanitizer' to 'default-field-sanitizer' to avoid syntax clash. Only define default field sanitizers if user-defined ones are absent. (normalize-extra-args): New procedure. ()[sanitizer]: New field. * doc/guix.texi (Complex Configurations): Document the newly added literals. * tests/services/configuration.scm: Add tests for the new literals. --- doc/guix.texi | 29 ++++- gnu/services/configuration.scm | 90 +++++++++++---- tests/services/configuration.scm | 183 ++++++++++++++++++++++++++++++- 3 files changed, 276 insertions(+), 26 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index 3e335306f1..8604b95f94 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -41216,7 +41216,7 @@ Complex Configurations (@var{field-name} (@var{type} @var{default-value}) @var{documentation} - @var{serializer}) + (serializer @var{serializer})) (@var{field-name} (@var{type}) @@ -41225,7 +41225,18 @@ Complex Configurations (@var{field-name} (@var{type}) @var{documentation} - @var{serializer}) + (serializer @var{serializer})) + +(@var{field-name} + (@var{type}) + @var{documentation} + (sanitizer @var{sanitizer}) + +(@var{field-name} + (@var{type}) + @var{documentation} + (sanitizer @var{sanitizer}) + (serializer @var{serializer})) @end example @var{field-name} is an identifier that denotes the name of the field in @@ -41248,6 +41259,20 @@ Complex Configurations @var{documentation} is a string formatted with Texinfo syntax which should provide a description of what setting this field does. +@var{sanitizer} is a procedure which takes one argument, +a user-supplied value, and returns a ``sanitized'' value for the field. +If no sanitizer is specified, a default sanitizer is used, which raises +an error if the value is not of type @var{type}. + +An example of a sanitizer for a field that accepts both strings and +symbols looks like this: +@lisp +(define (sanitize-foo value) + (cond ((string? value) value) + ((symbol? value) (symbol->string value)) + (else (error "bad value")))) +@end lisp + @var{serializer} is the name of a procedure which takes two arguments, the first is the name of the field, and the second is the value corresponding to the field. The procedure should return a string or diff --git a/gnu/services/configuration.scm b/gnu/services/configuration.scm index 174c2f20d2..4f3c6e2331 100644 --- a/gnu/services/configuration.scm +++ b/gnu/services/configuration.scm @@ -6,6 +6,7 @@ ;;; Copyright © 2021, 2022 Maxim Cournoyer ;;; Copyright © 2021 Andrew Tropin ;;; Copyright © 2022 Maxime Devos +;;; Copyright © 2023 Bruno Victal ;;; ;;; This file is part of GNU Guix. ;;; @@ -28,7 +29,8 @@ (define-module (gnu services configuration) #:use-module (guix gexp) #:use-module ((guix utils) #:select (source-properties->location)) #:use-module ((guix diagnostics) - #:select (formatted-message location-file &error-location)) + #:select (formatted-message location-file &error-location + warning)) #:use-module ((guix modules) #:select (file-name->module-name)) #:use-module (guix i18n) #:autoload (texinfo) (texi-fragment->stexi) @@ -37,6 +39,7 @@ (define-module (gnu services configuration) #:use-module (ice-9 format) #:use-module (ice-9 match) #:use-module (srfi srfi-1) + #:use-module (srfi srfi-26) #:use-module (srfi srfi-34) #:use-module (srfi srfi-35) #:export (configuration-field @@ -44,6 +47,7 @@ (define-module (gnu services configuration) configuration-field-type configuration-missing-field configuration-field-error + configuration-field-sanitizer configuration-field-serializer configuration-field-getter configuration-field-default-value-thunk @@ -116,6 +120,7 @@ (define-record-type* (type configuration-field-type) (getter configuration-field-getter) (predicate configuration-field-predicate) + (sanitizer configuration-field-sanitizer) (serializer configuration-field-serializer) (default-value-thunk configuration-field-default-value-thunk) (documentation configuration-field-documentation)) @@ -181,11 +186,44 @@ (define (normalize-field-type+def s) (values #'(field-type %unset-value))))) (define (define-configuration-helper serialize? serializer-prefix syn) + + (define (normalize-extra-args s) + "Extract and normalize arguments following @var{doc}." + (let loop ((s s) + (sanitizer* %unset-value) + (serializer* %unset-value)) + (syntax-case s (sanitizer serializer empty-serializer) + (((sanitizer proc) tail ...) + (if (maybe-value-set? sanitizer*) + (syntax-violation 'sanitizer "duplicate entry" + #'proc) + (loop #'(tail ...) #'proc serializer*))) + (((serializer proc) tail ...) + (if (maybe-value-set? serializer*) + (syntax-violation 'serializer "duplicate or conflicting entry" + #'proc) + (loop #'(tail ...) sanitizer* #'proc))) + ((empty-serializer tail ...) + (if (maybe-value-set? serializer*) + (syntax-violation 'empty-serializer + "duplicate or conflicting entry" #f) + (loop #'(tail ...) sanitizer* #'empty-serializer))) + (() ; stop condition + (values (list sanitizer* serializer*))) + ((proc) ; TODO: deprecated, to be removed + (null? (filter-map maybe-value-set? (list sanitizer* serializer*))) + (begin + (warning #f (G_ "specifying serializers after documentation is \ +deprecated, use (serializer ~a) instead~%") (syntax->datum #'proc)) + (values (list %unset-value #'proc))))))) + (syntax-case syn () - ((_ stem (field field-type+def doc custom-serializer ...) ...) + ((_ stem (field field-type+def doc extra-args ...) ...) (with-syntax ((((field-type def) ...) - (map normalize-field-type+def #'(field-type+def ...)))) + (map normalize-field-type+def #'(field-type+def ...))) + (((sanitizer* serializer*) ...) + (map normalize-extra-args #'((extra-args ...) ...)))) (with-syntax (((field-getter ...) (map (lambda (field) @@ -200,21 +238,18 @@ (define (define-configuration-helper serialize? serializer-prefix syn) ((field-type default-value) default-value)) #'((field-type def) ...))) + ((field-sanitizer ...) + (map maybe-value #'(sanitizer* ...))) ((field-serializer ...) - (map (lambda (type custom-serializer) + (map (lambda (type proc) (and serialize? - (match custom-serializer - ((serializer) - serializer) - (() - (if serializer-prefix - (id #'stem - serializer-prefix - #'serialize- type) - (id #'stem #'serialize- type)))))) + (or (maybe-value proc) + (if serializer-prefix + (id #'stem serializer-prefix #'serialize- type) + (id #'stem #'serialize- type))))) #'(field-type ...) - #'((custom-serializer ...) ...)))) - (define (field-sanitizer name pred) + #'(serializer* ...)))) + (define (default-field-sanitizer name pred) ;; Define a macro for use as a record field sanitizer, where NAME ;; is the name of the field and PRED is the predicate that tells ;; whether a value is valid for this field. @@ -235,21 +270,29 @@ (define (define-configuration-helper serialize? serializer-prefix syn) #`(begin ;; Define field validation macros. - #,@(map field-sanitizer - #'(field ...) - #'(field-predicate ...)) + #,@(filter-map (lambda (name pred sanitizer) + (if sanitizer + #f + (default-field-sanitizer name pred))) + #'(field ...) + #'(field-predicate ...) + #'(field-sanitizer ...)) (define-record-type* #,(id #'stem #'< #'stem #'>) stem #,(id #'stem #'make- #'stem) #,(id #'stem #'stem #'?) - #,@(map (lambda (name getter def) - #`(#,name #,getter (default #,def) + #,@(map (lambda (name getter def sanitizer) + #`(#,name #,getter + (default #,def) (sanitize - #,(id #'stem #'validate- #'stem #'- name)))) + #,(or sanitizer + (id #'stem + #'validate- #'stem #'- name))))) #'(field ...) #'(field-getter ...) - #'(field-default ...)) + #'(field-default ...) + #'(field-sanitizer ...)) (%location #,(id #'stem #'stem #'-source-location) (default (and=> (current-source-location) source-properties->location)) @@ -261,6 +304,9 @@ (define (define-configuration-helper serialize? serializer-prefix syn) (type 'field-type) (getter field-getter) (predicate field-predicate) + (sanitizer + (or field-sanitizer + (id #'stem #'validate- #'stem #'- #'field))) (serializer field-serializer) (default-value-thunk (lambda () diff --git a/tests/services/configuration.scm b/tests/services/configuration.scm index 4f8a74dc8a..0392cce927 100644 --- a/tests/services/configuration.scm +++ b/tests/services/configuration.scm @@ -2,6 +2,7 @@ ;;; Copyright © 2021, 2022 Maxim Cournoyer ;;; Copyright © 2021 Xinglu Chen ;;; Copyright © 2022 Ludovic Courtès +;;; Copyright © 2023 Bruno Victal ;;; ;;; This file is part of GNU Guix. ;;; @@ -22,6 +23,7 @@ (define-module (tests services configuration) #:use-module (gnu services configuration) #:use-module (guix diagnostics) #:use-module (guix gexp) + #:autoload (guix i18n) (G_) #:use-module (srfi srfi-34) #:use-module (srfi srfi-64)) @@ -46,14 +48,14 @@ (define-configuration port-configuration (port-configuration-port (port-configuration))) (test-equal "wrong type for a field" - '("configuration.scm" 57 11) ;error location + '("configuration.scm" 59 11) ;error location (guard (c ((configuration-error? c) (let ((loc (error-location c))) (list (basename (location-file loc)) (location-line loc) (location-column loc))))) (port-configuration - ;; This is line 56; the test relies on line/column numbers! + ;; This is line 58; the test relies on line/column numbers! (port "This is not a number!")))) (define-configuration port-configuration-cs @@ -109,6 +111,183 @@ (define-configuration configuration-with-prefix (let ((config (configuration-with-prefix))) (serialize-configuration config configuration-with-prefix-fields)))) + +;;; +;;; define-configuration macro, extra-args literals +;;; + +(define (eval-gexp x) + "Get serialized config as string." + (eval (gexp->approximate-sexp x) + (current-module))) + +(define (port? value) + (or (string? value) (number? value))) + +(define (sanitize-port value) + (cond ((number? value) value) + ((string? value) (string->number value)) + (else (raise (formatted-message (G_ "Bad value: ~a") value))))) + +(test-group "Basic sanitizer literal tests" + (define serialize-port serialize-number) + + (define-configuration config-with-sanitizer + (port + (port 80) + "Lorem Ipsum." + (sanitizer sanitize-port))) + + (test-equal "default value, sanitizer" + 80 + (config-with-sanitizer-port (config-with-sanitizer))) + + (test-equal "string value, sanitized to number" + 56 + (config-with-sanitizer-port (config-with-sanitizer + (port "56")))) + + (define (custom-serialize-port field-name value) + (number->string value)) + + (define-configuration config-serializer + (port + (port 80) + "Lorem Ipsum." + (serializer custom-serialize-port))) + + (test-equal "default value, serializer literal" + "80" + (eval-gexp + (serialize-configuration (config-serializer) + config-serializer-fields)))) + +(test-group "empty-serializer as literal/procedure tests" + (define-configuration config-with-literal + (port + (port 80) + "Lorem Ipsum." + empty-serializer)) + + (define-configuration config-with-proc + (port + (port 80) + "Lorem Ipsum." + (serializer empty-serializer))) + + (test-equal "empty-serializer as literal" + "" + (eval-gexp + (serialize-configuration (config-with-literal) + config-with-literal-fields))) + + (test-equal "empty-serializer as procedure" + "" + (eval-gexp + (serialize-configuration (config-with-proc) + config-with-proc-fields)))) + +(test-group "permutation tests" + (define-configuration config-san+empty-ser + (port + (port 80) + "Lorem Ipsum." + (sanitizer sanitize-port) + empty-serializer)) + + (define-configuration config-san+ser + (port + (port 80) + "Lorem Ipsum." + (sanitizer sanitize-port) + (serializer (lambda _ "foo")))) + + (test-equal "default value, sanitizer, permutation" + 80 + (config-san+empty-ser-port (config-san+empty-ser))) + + (test-equal "default value, serializer, permutation" + "foo" + (eval-gexp + (serialize-configuration (config-san+ser) config-san+ser-fields))) + + (test-equal "string value sanitized to number, permutation" + 56 + (config-san+ser-port (config-san+ser + (port "56")))) + + ;; Ordering tests. + (define-configuration config-ser+san + (port + (port 80) + "Lorem Ipsum." + (sanitizer sanitize-port) + (serializer (lambda _ "foo")))) + + (define-configuration config-empty-ser+san + (port + (port 80) + "Lorem Ipsum." + empty-serializer + (sanitizer sanitize-port))) + + (test-equal "default value, sanitizer, permutation 2" + 56 + (config-empty-ser+san-port (config-empty-ser+san + (port "56")))) + + (test-equal "default value, serializer, permutation 2" + "foo" + (eval-gexp + (serialize-configuration (config-ser+san) config-ser+san-fields)))) + +(test-group "duplicated/conflicting entries" + (test-error + "duplicate sanitizer" #t + (macroexpand '(define-configuration dupe-san + (foo + (list '()) + "Lorem Ipsum." + (sanitizer (lambda () #t)) + (sanitizer (lambda () #t)))))) + + (test-error + "duplicate serializer" #t + (macroexpand '(define-configuration dupe-ser + (foo + (list '()) + "Lorem Ipsum." + (serializer (lambda _ "")) + (serializer (lambda _ "")))))) + + (test-error + "conflicting use of serializer + empty-serializer" #t + (macroexpand '(define-configuration ser+empty-ser + (foo + (list '()) + "Lorem Ipsum." + (serializer (lambda _ "lorem")) + empty-serializer))))) + +(test-group "Mix of deprecated and new syntax" + (test-error + "Mix of bare serializer and new syntax" #t + (macroexpand '(define-configuration mixed + (foo + (list '()) + "Lorem Ipsum." + (sanitizer (lambda () #t)) + (lambda _ "lorem"))))) + + (test-error + "Mix of bare serializer and new syntax, permutation)" #t + (macroexpand '(define-configuration mixed + (foo + (list '()) + "Lorem Ipsum." + (lambda _ "lorem") + (sanitizer (lambda () #t))))))) + ;;; ;;; define-maybe macro. -- 2.39.1 From unknown Fri Jun 20 07:19:24 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#62298] [PATCH v2 8/8] services: mympd: Use user-account (resp. user-group) for user (resp. group) fields. Resent-From: Bruno Victal Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 25 Mar 2023 00:50:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 62298 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Liliana Marie Prikler Cc: ludo@gnu.org, 62298@debbugs.gnu.org, maxim.cournoyer@gmail.com Received: via spool by 62298-submit@debbugs.gnu.org id=B62298.167970537631540 (code B ref 62298); Sat, 25 Mar 2023 00:50:01 +0000 Received: (at 62298) by debbugs.gnu.org; 25 Mar 2023 00:49:36 +0000 Received: from localhost ([127.0.0.1]:41762 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pfs6C-0008Ce-Bs for submit@debbugs.gnu.org; Fri, 24 Mar 2023 20:49:36 -0400 Received: from smtpmciv1.myservices.hosting ([185.26.107.237]:58848) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pfs6A-0008CW-L1 for 62298@debbugs.gnu.org; Fri, 24 Mar 2023 20:49:35 -0400 Received: from mail1.netim.hosting (unknown [185.26.106.173]) by smtpmciv1.myservices.hosting (Postfix) with ESMTP id 6871B20E2A; Sat, 25 Mar 2023 01:49:33 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by mail1.netim.hosting (Postfix) with ESMTP id B3EC08009B; Sat, 25 Mar 2023 01:39:51 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at mail1.netim.hosting Received: from mail1.netim.hosting ([127.0.0.1]) by localhost (mail1-2.netim.hosting [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id aFj2IqzOKlOb; Sat, 25 Mar 2023 01:39:51 +0100 (CET) Received: from [192.168.1.239] (unknown [10.192.1.83]) (Authenticated sender: lumen@makinata.eu) by mail1.netim.hosting (Postfix) with ESMTPSA id 244AD8009A; Sat, 25 Mar 2023 01:39:51 +0100 (CET) Message-ID: <8ce45dff-8f82-78de-fba1-27bf96168b7e@makinata.eu> Date: Sat, 25 Mar 2023 00:39:46 +0000 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.8.0 Content-Language: en-US References: <364a2fe961ddce2c4668c0c8b78f46bffe2c2096.1679583701.git.mirai@makinata.eu> From: Bruno Victal In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -1.1 (-) 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.1 (--) On 2023-03-23 19:19, Liliana Marie Prikler wrote: > Am Donnerstag, dem 23.03.2023 um 15:02 +0000 schrieb Bruno Victal: >> +(define %mympd-user >> +  (user-account >> +      (name "mympd") >> +      (group "mympd") >> +      (system? #t) >> +      (comment "myMPD user") >> +      (home-directory "/var/empty") >> +      (shell (file-append shadow "/sbin/nologin")))) >> + >> +(define %mympd-group >> +  (user-group >> +   (name "mympd") >> +   (system? #t))) >> + >> +;;; TODO: procedures for unsupported value types, to be removed. >> +(define (mympd-user-sanitizer value) >> +  (cond ((user-account? value) value) >> +        ((string? value) >> +         (warning (G_ "string value for 'user' is not supported, use >> \ >> +user-account instead~%")) >> +         (user-account >> +          (inherit %mympd-user) >> +          (name value) >> +          ;; XXX: this is to be lazily substituted in (…-accounts) >> +          ;;      with the value from 'group'. >> +          (group %lazy-group))) >> +        (else >> +         (configuration-field-error #f 'user value)))) > I think an in-place creation of the user and group might make more > sense than defining a dummy value for inheritance purposes. Same > probably also applies to the MPD service patch. Though already replied to in private via IRC, to leave this clarified for other reviewers, these are not dummy values. They're the default values that the service will use if none are specified. The inheritance happened to be a bonus here. Cheers, Bruno From unknown Fri Jun 20 07:19:24 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#62298] [PATCH v3 2/5] services: replace bare serializers with (serializer ...) Resent-From: Bruno Victal Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 25 Mar 2023 00:52:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 62298 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 62298@debbugs.gnu.org Cc: ludo@gnu.org, Bruno Victal , liliana.prikler@gmail.com, maxim.cournoyer@gmail.com Received: via spool by 62298-submit@debbugs.gnu.org id=B62298.167970547531713 (code B ref 62298); Sat, 25 Mar 2023 00:52:02 +0000 Received: (at 62298) by debbugs.gnu.org; 25 Mar 2023 00:51:15 +0000 Received: from localhost ([127.0.0.1]:41769 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pfs7l-0008FJ-RK for submit@debbugs.gnu.org; Fri, 24 Mar 2023 20:51:15 -0400 Received: from smtpmciv4.myservices.hosting ([185.26.107.240]:51818) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pfs7k-0008FA-Cr for 62298@debbugs.gnu.org; Fri, 24 Mar 2023 20:51:13 -0400 Received: from mail1.netim.hosting (unknown [185.26.106.173]) by smtpmciv4.myservices.hosting (Postfix) with ESMTP id 249BB20820; Sat, 25 Mar 2023 01:51:10 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by mail1.netim.hosting (Postfix) with ESMTP id BE9248009D; Sat, 25 Mar 2023 01:51:10 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at mail1.netim.hosting Received: from mail1.netim.hosting ([127.0.0.1]) by localhost (mail1-2.netim.hosting [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id D108vYj26jod; Sat, 25 Mar 2023 01:51:10 +0100 (CET) Received: from guix-nuc.home.arpa (bl9-119-177.dsl.telepac.pt [85.242.119.177]) (Authenticated sender: lumen@makinata.eu) by mail1.netim.hosting (Postfix) with ESMTPSA id B555A80098; Sat, 25 Mar 2023 01:51:09 +0100 (CET) From: Bruno Victal Date: Sat, 25 Mar 2023 00:46:45 +0000 Message-Id: <70ee908130f8ffbd9d2c74a96bccff130f0aa3e1.1679705137.git.mirai@makinata.eu> X-Mailer: git-send-email 2.39.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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/home/services/shells.scm (home-zsh-configuration)[environment-variables]: Use (serializer ...). (home-bash-configuration)[aliases, environment-variables]: Ditto. (home-fish-configuration)[abbreviations, aliases, environment-variables]: Ditto. * gnu/services/audio.scm (mpd-configuration)[music-dir, playlist-dir, endpoints] [address, inputs, archive-plugins, input-cache-size, decoders, filters] [playlist-plugins]: Ditto. * gnu/services/linux.scm (fstrim-configuration)[extra-arguments]: Ditto. * gnu/services/security.scm (fail2ban-jail-configuration)[backend, log-encoding] [extra-content]: Ditto. * tests/services/configuration.scm: Update tests. Add test for deprecated bare serializers. --- gnu/home/services/shells.scm | 12 ++++----- gnu/services/audio.scm | 45 ++++++++++++++++---------------- gnu/services/linux.scm | 7 ++--- gnu/services/security.scm | 6 ++--- tests/services/configuration.scm | 11 +++++++- 5 files changed, 46 insertions(+), 35 deletions(-) diff --git a/gnu/home/services/shells.scm b/gnu/home/services/shells.scm index 3326eb37f4..f05f2221d6 100644 --- a/gnu/home/services/shells.scm +++ b/gnu/home/services/shells.scm @@ -133,7 +133,7 @@ (define-configuration home-zsh-configuration (environment-variables (alist '()) "Association list of environment variables to set for the Zsh session." - serialize-posix-env-vars) + (serializer serialize-posix-env-vars)) (zshenv (text-config '()) "List of file-like objects, which will be added to @file{.zshenv}. @@ -334,7 +334,7 @@ (define-configuration home-bash-configuration rules for the @code{home-environment-variables-service-type} apply here (@pxref{Essential Home Services}). The contents of this field will be added after the contents of the @code{bash-profile} field." - serialize-posix-env-vars) + (serializer serialize-posix-env-vars)) (aliases (alist '()) "Association list of aliases to set for the Bash session. The aliases will be @@ -351,7 +351,7 @@ (define-configuration home-bash-configuration @example alias ls=\"ls -alF\" @end example" - bash-serialize-aliases) + (serializer bash-serialize-aliases)) (bash-profile (text-config '()) "List of file-like objects, which will be added to @file{.bash_profile}. @@ -536,19 +536,19 @@ (define-configuration home-fish-configuration (environment-variables (alist '()) "Association list of environment variables to set in Fish." - serialize-fish-env-vars) + (serializer serialize-fish-env-vars)) (aliases (alist '()) "Association list of aliases for Fish, both the key and the value should be a string. An alias is just a simple function that wraps a command, If you want something more akin to @dfn{aliases} in POSIX shells, see the @code{abbreviations} field." - serialize-fish-aliases) + (serializer serialize-fish-aliases)) (abbreviations (alist '()) "Association list of abbreviations for Fish. These are words that, when typed in the shell, will automatically expand to the full text." - serialize-fish-abbreviations)) + (serializer serialize-fish-abbreviations))) (define (fish-files-service config) `(("fish/config.fish" diff --git a/gnu/services/audio.scm b/gnu/services/audio.scm index 4885fb8424..c073b85a32 100644 --- a/gnu/services/audio.scm +++ b/gnu/services/audio.scm @@ -370,7 +370,7 @@ (define-configuration mpd-configuration (music-dir ; TODO: deprecated, remove later maybe-string "The directory to scan for music files." - mpd-serialize-deprecated-field) + (serializer mpd-serialize-deprecated-field)) (playlist-directory maybe-string @@ -379,7 +379,7 @@ (define-configuration mpd-configuration (playlist-dir ; TODO: deprecated, remove later maybe-string "The directory to store playlists." - mpd-serialize-deprecated-field) + (serializer mpd-serialize-deprecated-field)) (db-file maybe-string @@ -405,16 +405,17 @@ (define-configuration mpd-configuration port is used. To use a Unix domain socket, an absolute path or a path starting with @code{~} can be specified here." - (lambda (_ endpoints) - (if (maybe-value-set? endpoints) - (mpd-serialize-list-of-strings "bind_to_address" endpoints) - ""))) + (serializer + (lambda (_ endpoints) + (if (maybe-value-set? endpoints) + (mpd-serialize-list-of-strings "bind_to_address" endpoints) + "")))) (address ; TODO: deprecated, remove later maybe-string "The address that mpd will bind to. To use a Unix domain socket, an absolute path can be specified here." - mpd-serialize-deprecated-field) + (serializer mpd-serialize-deprecated-field)) (database maybe-mpd-plugin @@ -431,29 +432,29 @@ (define-configuration mpd-configuration (inputs (list-of-mpd-plugin '()) "List of MPD input plugin configurations." - (lambda (_ x) - (mpd-serialize-list-of-mpd-plugin "input" x))) + (serializer (lambda (_ x) + (mpd-serialize-list-of-mpd-plugin "input" x)))) (archive-plugins (list-of-mpd-plugin '()) "List of MPD archive plugin configurations." - (lambda (_ x) - (mpd-serialize-list-of-mpd-plugin "archive_plugin" x))) + (serializer (lambda (_ x) + (mpd-serialize-list-of-mpd-plugin "archive_plugin" x)))) (input-cache-size maybe-string "MPD input cache size." - (lambda (_ x) - (if (maybe-value-set? x) - #~(string-append "\ninput_cache {\n" - #$(mpd-serialize-string "size" x) - "}\n") ""))) + (serializer (lambda (_ x) + (if (maybe-value-set? x) + #~(string-append "\ninput_cache {\n" + #$(mpd-serialize-string "size" x) + "}\n") "")))) (decoders (list-of-mpd-plugin '()) "List of MPD decoder plugin configurations." - (lambda (_ x) - (mpd-serialize-list-of-mpd-plugin "decoder" x))) + (serializer (lambda (_ x) + (mpd-serialize-list-of-mpd-plugin "decoder" x)))) (resampler maybe-mpd-plugin @@ -462,8 +463,8 @@ (define-configuration mpd-configuration (filters (list-of-mpd-plugin '()) "List of MPD filter plugin configurations." - (lambda (_ x) - (mpd-serialize-list-of-mpd-plugin "filter" x))) + (serializer (lambda (_ x) + (mpd-serialize-list-of-mpd-plugin "filter" x)))) (outputs (list-of-mpd-plugin-or-output (list (mpd-output))) @@ -473,8 +474,8 @@ (define-configuration mpd-configuration (playlist-plugins (list-of-mpd-plugin '()) "List of MPD playlist plugin configurations." - (lambda (_ x) - (mpd-serialize-list-of-mpd-plugin "playlist_plugin" x))) + (serializer (lambda (_ x) + (mpd-serialize-list-of-mpd-plugin "playlist_plugin" x)))) (extra-options (alist '()) diff --git a/gnu/services/linux.scm b/gnu/services/linux.scm index d085b375a2..229220eeb1 100644 --- a/gnu/services/linux.scm +++ b/gnu/services/linux.scm @@ -213,9 +213,10 @@ (define-configuration fstrim-configuration maybe-list-of-strings "Extra options to append to @command{fstrim} (run @samp{man fstrim} for more information)." - (lambda (_ value) - (if (maybe-value-set? value) - value '()))) + (serializer + (lambda (_ value) + (if (maybe-value-set? value) + value '())))) (prefix fstrim-)) (define (serialize-fstrim-configuration config) diff --git a/gnu/services/security.scm b/gnu/services/security.scm index 8116072920..e750bb468b 100644 --- a/gnu/services/security.scm +++ b/gnu/services/security.scm @@ -200,7 +200,7 @@ (define-configuration fail2ban-jail-configuration "Backend to use to detect changes in the @code{log-path}. The default is 'auto. To consult the defaults of the jail configuration, refer to the @file{/etc/fail2ban/jail.conf} file of the @code{fail2ban} package." - fail2ban-jail-configuration-serialize-backend) + (serializer fail2ban-jail-configuration-serialize-backend)) (max-retry maybe-integer "The number of failures before a host get banned @@ -269,7 +269,7 @@ (define-configuration fail2ban-jail-configuration maybe-symbol "The encoding of the log files handled by the jail. Possible values are: @code{'ascii}, @code{'utf-8} and @code{'auto}." - fail2ban-jail-configuration-serialize-log-encoding) + (serializer fail2ban-jail-configuration-serialize-log-encoding)) (log-path (list-of-strings '()) "The file names of the log files to be monitored.") @@ -280,7 +280,7 @@ (define-configuration fail2ban-jail-configuration (text-config '()) "Extra content for the jail configuration, provided as a list of file-like objects." - serialize-text-config) + (serializer serialize-text-config)) (prefix fail2ban-jail-configuration-)) (define list-of-fail2ban-jail-configurations? diff --git a/tests/services/configuration.scm b/tests/services/configuration.scm index 0392cce927..8ad5907f37 100644 --- a/tests/services/configuration.scm +++ b/tests/services/configuration.scm @@ -82,6 +82,9 @@ (define (custom-number-serializer name value) (format #f "~a = ~a;" name value)) (define-configuration serializable-configuration + (port (number 80) "The port number." (serializer custom-number-serializer))) + +(define-configuration serializable-configuration-deprecated (port (number 80) "The port number." custom-number-serializer)) (test-assert "serialize-configuration" @@ -89,8 +92,14 @@ (define-configuration serializable-configuration (let ((config (serializable-configuration))) (serialize-configuration config serializable-configuration-fields)))) +(test-assert "serialize-configuration [deprecated]" + (gexp? + (let ((config (serializable-configuration-deprecated))) + (serialize-configuration + config serializable-configuration-deprecated-fields)))) + (define-configuration serializable-configuration - (port (number 80) "The port number." custom-number-serializer) + (port (number 80) "The port number." (serializer custom-number-serializer)) (no-serialization)) (test-assert "serialize-configuration with no-serialization" -- 2.39.1 From unknown Fri Jun 20 07:19:24 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#62298] [PATCH v3 4/5] services: mpd: Use user-account (resp. user-group) for user (resp. group) fields. Resent-From: Bruno Victal Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 25 Mar 2023 00:52:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 62298 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 62298@debbugs.gnu.org Cc: ludo@gnu.org, Bruno Victal , liliana.prikler@gmail.com, maxim.cournoyer@gmail.com Received: via spool by 62298-submit@debbugs.gnu.org id=B62298.167970547931725 (code B ref 62298); Sat, 25 Mar 2023 00:52:02 +0000 Received: (at 62298) by debbugs.gnu.org; 25 Mar 2023 00:51:19 +0000 Received: from localhost ([127.0.0.1]:41771 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pfs7r-0008Fc-9b for submit@debbugs.gnu.org; Fri, 24 Mar 2023 20:51:19 -0400 Received: from smtpm5.myservices.hosting ([185.26.105.236]:41180) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pfs7l-0008FB-6y for 62298@debbugs.gnu.org; Fri, 24 Mar 2023 20:51:14 -0400 Received: from mail1.netim.hosting (unknown [185.26.106.173]) by smtpm5.myservices.hosting (Postfix) with ESMTP id ECF8820D40; Sat, 25 Mar 2023 01:51:11 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by mail1.netim.hosting (Postfix) with ESMTP id 9FD3A8009E; Sat, 25 Mar 2023 01:51:11 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at mail1.netim.hosting Received: from mail1.netim.hosting ([127.0.0.1]) by localhost (mail1-2.netim.hosting [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id mMWtEkjI6KtT; Sat, 25 Mar 2023 01:51:11 +0100 (CET) Received: from guix-nuc.home.arpa (bl9-119-177.dsl.telepac.pt [85.242.119.177]) (Authenticated sender: lumen@makinata.eu) by mail1.netim.hosting (Postfix) with ESMTPSA id BB9068009B; Sat, 25 Mar 2023 01:51:10 +0100 (CET) From: Bruno Victal Date: Sat, 25 Mar 2023 00:46:47 +0000 Message-Id: X-Mailer: git-send-email 2.39.1 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 (-) Deprecate using strings for these fields and prefer user-account (resp. user-group) instead to avoid duplication within account-service-type. Fixes #61570 . * gnu/services/audio.scm (mpd-serialize-user-account, mpd-serialize-user-group) (mpd-user-sanitizer, mpd-group-sanitizer): New procedure. (%mpd-user, %mpd-group): New variable. (mpd-configuration)[user, group]: Set value type to user-account (resp. user-group). (mpd-shepherd-service): Adapt for user-account values in user field. (mpd-accounts): Adapt for user-account (resp. user-group) in user (resp. group) field. * doc/guix.texi (Audio Services): Update documentation. --- doc/guix.texi | 4 +- gnu/services/audio.scm | 89 ++++++++++++++++++++++++++++++++++-------- 2 files changed, 74 insertions(+), 19 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index 8604b95f94..10ce098a21 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -33491,10 +33491,10 @@ Audio Services @item @code{package} (default: @code{mpd}) (type: file-like) The MPD package. -@item @code{user} (default: @code{"mpd"}) (type: string) +@item @code{user} (type: maybe-user-account) The user to run mpd as. -@item @code{group} (default: @code{"mpd"}) (type: string) +@item @code{group} (type: maybe-user-group) The group to run mpd as. @item @code{shepherd-requirement} (default: @code{()}) (type: list-of-symbol) diff --git a/gnu/services/audio.scm b/gnu/services/audio.scm index bc4aed71dc..55749111ab 100644 --- a/gnu/services/audio.scm +++ b/gnu/services/audio.scm @@ -140,6 +140,14 @@ (define (uglify-field-name field-name) (define list-of-symbol? (list-of symbol?)) +;; Helpers for deprecated field types, to be removed later. +(define %lazy-group (make-symbol "%lazy-group")) + +(define (inject-group-into-user user group) + (user-account + (inherit user) + (group (user-group-name group)))) + ;;; ;;; MPD @@ -164,9 +172,32 @@ (define mpd-serialize-boolean mpd-serialize-field) (define (mpd-serialize-list-of-strings field-name value) #~(string-append #$@(map (cut mpd-serialize-string field-name <>) value))) +(define (mpd-serialize-user-account field-name value) + (mpd-serialize-string field-name (user-account-name value))) + +(define (mpd-serialize-user-group field-name value) + (mpd-serialize-string field-name (user-group-name value))) + (define-maybe string (prefix mpd-)) (define-maybe list-of-strings (prefix mpd-)) (define-maybe boolean (prefix mpd-)) +(define-maybe user-account (prefix mpd-)) +(define-maybe user-group (prefix mpd-)) + +(define %mpd-user + (user-account + (name "mpd") + (group "mpd") + (system? #t) + (comment "Music Player Daemon (MPD) user") + ;; MPD can use $HOME (or $XDG_CONFIG_HOME) to place its data + (home-directory "/var/lib/mpd") + (shell (file-append shadow "/sbin/nologin")))) + +(define %mpd-group + (user-group + (name "mpd") + (system? #t))) ;;; TODO: Procedures for deprecated fields, to be removed. @@ -197,6 +228,33 @@ (define (mpd-serialize-port field-name value) (define-maybe port (prefix mpd-)) +;;; Procedures for unsupported value types, to be removed. + +(define (mpd-user-sanitizer value) + (cond ((user-account? value) value) + ((string? value) + (warning (G_ "string value for 'user' is deprecated, use \ +user-account instead~%")) + (user-account + (inherit %mpd-user) + (name value) + ;; XXX: This is to be lazily substituted in (…-accounts) + ;; with the value from 'group'. + (group %lazy-group))) + (else + (configuration-field-error #f 'user value)))) + +(define (mpd-group-sanitizer value) + (cond ((user-group? value) value) + ((string? value) + (warning (G_ "string value for 'group' is deprecated, use \ +user-group instead~%")) + (user-group + (inherit %mpd-group) + (name value))) + (else + (configuration-field-error #f 'group value)))) + ;;; ;; Generic MPD plugin record, lists only the most prevalent fields. @@ -347,12 +405,14 @@ (define-configuration mpd-configuration empty-serializer) (user - (string "mpd") - "The user to run mpd as.") + (maybe-user-account %mpd-user) + "The user to run mpd as." + (sanitizer mpd-user-sanitizer)) (group - (string "mpd") - "The group to run mpd as.") + (maybe-user-group %mpd-group) + "The group to run mpd as." + (sanitizer mpd-group-sanitizer)) (shepherd-requirement (list-of-symbol '()) @@ -517,7 +577,8 @@ (define (mpd-shepherd-service config) log-file playlist-directory db-file state-file sticker-file environment-variables) - (let* ((config-file (mpd-serialize-configuration config))) + (let ((config-file (mpd-serialize-configuration config)) + (username (user-account-name user))) (shepherd-service (documentation "Run the MPD (Music Player Daemon)") (requirement `(user-processes loopback ,@shepherd-requirement)) @@ -526,7 +587,7 @@ (define (mpd-shepherd-service config) (and=> #$(maybe-value log-file) (compose mkdir-p dirname)) - (let ((user (getpw #$user))) + (let ((user (getpw #$username))) (for-each (lambda (x) (when (and x (not (file-exists? x))) @@ -560,17 +621,11 @@ (define (mpd-shepherd-service config) (define (mpd-accounts config) (match-record config (user group) - (list (user-group - (name group) - (system? #t)) - (user-account - (name user) - (group group) - (system? #t) - (comment "Music Player Daemon (MPD) user") - ;; MPD can use $HOME (or $XDG_CONFIG_HOME) to place its data - (home-directory "/var/lib/mpd") - (shell (file-append shadow "/sbin/nologin")))))) + ;; TODO: Deprecation code, to be removed. + (let ((user (if (eq? (user-account-group user) %lazy-group) + (inject-group-into-user user group) + user))) + (list user group)))) (define mpd-service-type (service-type -- 2.39.1 From unknown Fri Jun 20 07:19:24 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#62298] [PATCH v3 5/5] services: mympd: Use user-account (resp. user-group) for user (resp. group) fields. Resent-From: Bruno Victal Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 25 Mar 2023 00:52:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 62298 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 62298@debbugs.gnu.org Cc: ludo@gnu.org, Bruno Victal , liliana.prikler@gmail.com, maxim.cournoyer@gmail.com Received: via spool by 62298-submit@debbugs.gnu.org id=B62298.167970548531743 (code B ref 62298); Sat, 25 Mar 2023 00:52:03 +0000 Received: (at 62298) by debbugs.gnu.org; 25 Mar 2023 00:51:25 +0000 Received: from localhost ([127.0.0.1]:41773 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pfs7w-0008Fu-RN for submit@debbugs.gnu.org; Fri, 24 Mar 2023 20:51:25 -0400 Received: from smtpm3.myservices.hosting ([185.26.105.234]:54846) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pfs7l-0008FD-KN for 62298@debbugs.gnu.org; Fri, 24 Mar 2023 20:51:24 -0400 Received: from mail1.netim.hosting (unknown [185.26.106.173]) by smtpm3.myservices.hosting (Postfix) with ESMTP id 5777A21102; Sat, 25 Mar 2023 01:51:12 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by mail1.netim.hosting (Postfix) with ESMTP id 099008009B; Sat, 25 Mar 2023 01:51:12 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at mail1.netim.hosting Received: from mail1.netim.hosting ([127.0.0.1]) by localhost (mail1-2.netim.hosting [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id H1GP8l842qYU; Sat, 25 Mar 2023 01:51:11 +0100 (CET) Received: from guix-nuc.home.arpa (bl9-119-177.dsl.telepac.pt [85.242.119.177]) (Authenticated sender: lumen@makinata.eu) by mail1.netim.hosting (Postfix) with ESMTPSA id 4C7008009A; Sat, 25 Mar 2023 01:51:11 +0100 (CET) From: Bruno Victal Date: Sat, 25 Mar 2023 00:46:48 +0000 Message-Id: X-Mailer: git-send-email 2.39.1 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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/audio.scm (%mympd-user, %mympd-group): New variable. (mympd-user-sanitizer, mympd-group-sanitizer): New procedure. (mympd-configuration)[user, group]: Set value type to user-account (resp. user-group). (mympd-serialize-configuration): Adapt for user-account values in user field. (mympd-accounts): Adapt for user-account (resp. user-group) in user (resp. group) field. --- doc/guix.texi | 4 +-- gnu/services/audio.scm | 75 ++++++++++++++++++++++++++++++++++-------- 2 files changed, 63 insertions(+), 16 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index 10ce098a21..1e36ea5183 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -33732,10 +33732,10 @@ Audio Services This is a list of symbols naming Shepherd services that this service will depend on. -@item @code{user} (default: @code{"mympd"}) (type: string) +@item @code{user} (type: maybe-user-account) Owner of the @command{mympd} process. -@item @code{group} (default: @code{"nogroup"}) (type: string) +@item @code{group} (type: maybe-user-group) Owner group of the @command{mympd} process. @item @code{work-directory} (default: @code{"/var/lib/mympd"}) (type: string) diff --git a/gnu/services/audio.scm b/gnu/services/audio.scm index 55749111ab..5faec5a0df 100644 --- a/gnu/services/audio.scm +++ b/gnu/services/audio.scm @@ -659,6 +659,53 @@ (define-configuration/no-serialization mympd-ip-acl (define-maybe/no-serialization integer) (define-maybe/no-serialization mympd-ip-acl) +;; XXX: These will shadow the previous definition used by mpd +;; and cause warnings to be shown. Maybe split the file +;; into audio/mpd.scm and audio/mympd.scm ? +#;(define-maybe/no-serialization user-account) +#;(define-maybe/no-serialization user-group) + +(define %mympd-user + (user-account + (name "mympd") + (group "mympd") + (system? #t) + (comment "myMPD user") + (home-directory "/var/empty") + (shell (file-append shadow "/sbin/nologin")))) + +(define %mympd-group + (user-group + (name "mympd") + (system? #t))) + +;;; TODO: Procedures for unsupported value types, to be removed. +(define (mympd-user-sanitizer value) + (cond ((user-account? value) value) + ((string? value) + (warning (G_ "string value for 'user' is not supported, use \ +user-account instead~%")) + (user-account + (inherit %mympd-user) + (name value) + ;; XXX: this is to be lazily substituted in (…-accounts) + ;; with the value from 'group'. + (group %lazy-group))) + (else + (configuration-field-error #f 'user value)))) + +(define (mympd-group-sanitizer value) + (cond ((user-group? value) value) + ((string? value) + (warning (G_ "string value for 'group' is not supported, use \ +user-group instead~%")) + (user-group + (inherit %mympd-group) + (name value))) + (else + (configuration-field-error #f 'group value)))) +;;; + ;; XXX: The serialization procedures are insufficient since we require ;; access to multiple fields at once. @@ -677,13 +724,15 @@ (define-configuration/no-serialization mympd-configuration empty-serializer) (user - (string "mympd") + (maybe-user-account %mympd-user) "Owner of the @command{mympd} process." + (sanitizer mympd-user-sanitizer) empty-serializer) (group - (string "nogroup") + (maybe-user-group %mympd-group) "Owner group of the @command{mympd} process." + (sanitizer mympd-group-sanitizer) empty-serializer) (work-directory @@ -818,7 +867,8 @@ (define (mympd-shepherd-service config) (match-record config (package shepherd-requirement user work-directory cache-directory log-level log-to) - (let ((log-level* (format #f "MYMPD_LOGLEVEL=~a" log-level))) + (let ((log-level* (format #f "MYMPD_LOGLEVEL=~a" log-level)) + (username (user-account-name user))) (shepherd-service (documentation "Run the myMPD daemon.") (requirement `(loopback user-processes @@ -828,7 +878,7 @@ (define (mympd-shepherd-service config) ,@shepherd-requirement)) (provision '(mympd)) (start #~(begin - (let* ((pw (getpwnam #$user)) + (let* ((pw (getpwnam #$username)) (uid (passwd:uid pw)) (gid (passwd:gid pw))) (for-each (lambda (dir) @@ -838,8 +888,8 @@ (define (mympd-shepherd-service config) (make-forkexec-constructor `(#$(file-append package "/bin/mympd") - "--user" #$user - #$@(if (eqv? log-to 'syslog) '("--syslog") '()) + "--user" #$username + #$@(if (eq? log-to 'syslog) '("--syslog") '()) "--workdir" #$work-directory "--cachedir" #$cache-directory) #:environment-variables (list #$log-level*) @@ -848,14 +898,11 @@ (define (mympd-shepherd-service config) (define (mympd-accounts config) (match-record config (user group) - (list (user-group (name group) - (system? #t)) - (user-account (name user) - (group group) - (system? #t) - (comment "myMPD user") - (home-directory "/var/empty") - (shell (file-append shadow "/sbin/nologin")))))) + ;; TODO: Deprecation code, to be removed. + (let ((user (if (eq? (user-account-group user) %lazy-group) + (inject-group-into-user user group) + user))) + (list user group)))) (define (mympd-log-rotation config) (match-record config (log-to) -- 2.39.1 From unknown Fri Jun 20 07:19:24 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#62298] [PATCH v3 3/5] services: mpd: Fix unintentional API breakage for mixer-type field. Resent-From: Bruno Victal Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 25 Mar 2023 01:00:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 62298 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 62298@debbugs.gnu.org Cc: ludo@gnu.org, Bruno Victal , liliana.prikler@gmail.com, maxim.cournoyer@gmail.com Received: via spool by 62298-submit@debbugs.gnu.org id=B62298.167970597432522 (code B ref 62298); Sat, 25 Mar 2023 01:00:02 +0000 Received: (at 62298) by debbugs.gnu.org; 25 Mar 2023 00:59:34 +0000 Received: from localhost ([127.0.0.1]:41789 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pfsFp-0008ST-KB for submit@debbugs.gnu.org; Fri, 24 Mar 2023 20:59:33 -0400 Received: from smtpmciv4.myservices.hosting ([185.26.107.240]:53382) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pfsFo-0008SM-RW for 62298@debbugs.gnu.org; Fri, 24 Mar 2023 20:59:33 -0400 Received: from mail1.netim.hosting (unknown [185.26.106.173]) by smtpmciv4.myservices.hosting (Postfix) with ESMTP id 84A372090F; Sat, 25 Mar 2023 01:59:30 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by mail1.netim.hosting (Postfix) with ESMTP id D729B80098; Sat, 25 Mar 2023 01:51:10 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at mail1.netim.hosting Received: from mail1.netim.hosting ([127.0.0.1]) by localhost (mail1-2.netim.hosting [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id xjTmlnpUxFAW; Sat, 25 Mar 2023 01:51:10 +0100 (CET) Received: from guix-nuc.home.arpa (bl9-119-177.dsl.telepac.pt [85.242.119.177]) (Authenticated sender: lumen@makinata.eu) by mail1.netim.hosting (Postfix) with ESMTPSA id 4034C8009A; Sat, 25 Mar 2023 01:51:10 +0100 (CET) From: Bruno Victal Date: Sat, 25 Mar 2023 00:46:46 +0000 Message-Id: <1fd3e13d1fb65d10fbf9bb6714a82f6a3c43c2e2.1679705137.git.mirai@makinata.eu> X-Mailer: git-send-email 2.39.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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/audio.scm (mpd-output)[mixer-type]: Use sanitizer to accept both strings and symbols as values. --- gnu/services/audio.scm | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/gnu/services/audio.scm b/gnu/services/audio.scm index c073b85a32..bc4aed71dc 100644 --- a/gnu/services/audio.scm +++ b/gnu/services/audio.scm @@ -140,6 +140,11 @@ (define (uglify-field-name field-name) (define list-of-symbol? (list-of symbol?)) + +;;; +;;; MPD +;;; + (define (mpd-serialize-field field-name value) (let ((field (if (string? field-name) field-name (uglify-field-name field-name))) @@ -294,7 +299,17 @@ (define-configuration mpd-output for this audio output: the @code{hardware} mixer, the @code{software} mixer, the @code{null} mixer (allows setting the volume, but with no effect; this can be used as a trick to implement an external mixer -External Mixer) or no mixer (@code{none}).") +External Mixer) or no mixer (@code{none})." + (sanitizer + (lambda (x) ; TODO: deprecated, remove me later. + (cond + ((symbol? x) + (warning (G_ "symbol value for 'mixer-type' is deprecated, \ +use string instead~%")) + (symbol->string x)) + ((string? x) x) + (else + (configuration-field-error #f 'mixer-type x)))))) (replay-gain-handler maybe-string -- 2.39.1 From unknown Fri Jun 20 07:19:24 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#62298] [PATCH v2 8/8] services: mympd: Use user-account (resp. user-group) for user (resp. group) fields. Resent-From: Liliana Marie Prikler Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 25 Mar 2023 12:29:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 62298 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Bruno Victal , Maxim Cournoyer Cc: 62298@debbugs.gnu.org, ludo@gnu.org Received: via spool by 62298-submit@debbugs.gnu.org id=B62298.167974732119047 (code B ref 62298); Sat, 25 Mar 2023 12:29:02 +0000 Received: (at 62298) by debbugs.gnu.org; 25 Mar 2023 12:28:41 +0000 Received: from localhost ([127.0.0.1]:42025 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pg30i-0004x8-Jb for submit@debbugs.gnu.org; Sat, 25 Mar 2023 08:28:40 -0400 Received: from mail-ed1-f66.google.com ([209.85.208.66]:45029) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pg30g-0004wu-4d for 62298@debbugs.gnu.org; Sat, 25 Mar 2023 08:28:38 -0400 Received: by mail-ed1-f66.google.com with SMTP id eh3so17789446edb.11 for <62298@debbugs.gnu.org>; Sat, 25 Mar 2023 05:28:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679747312; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:from:to:cc:subject :date:message-id:reply-to; bh=qxb135tMfV97L34ZNSW1NXEWJUFIe5744xrzQdNprzI=; b=Lc6Rag4qffUF8xWB3TxtXPGmyrGPijDMZXIu2BD37Ulcgva8tj4WJgt6jxg/dEW038 7SzCuwca/Zd2ZqxWvIyVe1fTNmoSxIMgi8Q55WqGurivVIziI5oXPhK2W1qnzFTnnQus +GoiydBA1V3Ve7xukzMGacXtt3xTC4vpls45MxpDmwGA8IrviZdTzn8CDgWOnT5OYaTb t0r68JyAReGQfJKGLCrG13MbGwX4nMJpZh93Jvlw5D2ehdE6xXXJx1FSR45f4asyuV63 BqgDexSXZRr275n1jt3sWzknjv2ZGrpwWUSZNUYV4IU/15oP82dUv1/nOfeOSqDeyBFl TpQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679747312; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=qxb135tMfV97L34ZNSW1NXEWJUFIe5744xrzQdNprzI=; b=A9gymBLL350yJ2vkimCfYdUz+w+J5FCj1KfCmBodWGf0ALnBzsYl7FGXtgQTwRDLwq hMgP0AhNTYNALd1AwWHOMW3tFd96T/Ma9Wpd4NeUfJfngjDhlALynJvpS/6+0jqyYBt2 1wA8gRpmhM+rzxikRqvWaY8e1kqEH3viawCkqeSWvqY9WH4WhLDv6jBQFBLHwJOrc4Ud +z33zGGmknziU1mxVD6juAUdSyclNeF6+/K0v/ItNxpkkojvA7TwzsdRvOfhSTBiGRf7 E3sM8xebO9CoPOSIJur6I6nfLJhNqPBh1OqwpvgQUyp7eOgfaigu0WW32fqfNiwN/XL9 9mTA== X-Gm-Message-State: AAQBX9fauGTOKqytHO+B5Q/0LRXhOKAW0WQ9zKQQEMoQU5uaZ9DhLbUx Ynix9i5zCpNmOrZgQj9O59GLeha45sNE1Q== X-Google-Smtp-Source: AKy350YH9soGsEaDyF2CdC4nG71qqcs7LYsgUbDjEvz58jAA2USEFdkMVxSdBtVRHINnyGX5Rmn15A== X-Received: by 2002:a17:906:f193:b0:92b:eca6:43fc with SMTP id gs19-20020a170906f19300b0092beca643fcmr5380517ejb.64.1679721721593; Fri, 24 Mar 2023 22:22:01 -0700 (PDT) Received: from lumine.fritz.box (85-127-52-93.dsl.dynamic.surfer.at. [85.127.52.93]) by smtp.gmail.com with ESMTPSA id b1-20020a1709065e4100b008ca52f7fbcbsm11251325eju.1.2023.03.24.22.22.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Mar 2023 22:22:01 -0700 (PDT) Message-ID: <164d0aafa0f598f742ed4a3b9d2c2cdac102f398.camel@gmail.com> From: Liliana Marie Prikler Date: Sat, 25 Mar 2023 06:21:59 +0100 In-Reply-To: <6adedff0-30d3-c1c4-7b10-ece811f517ab@makinata.eu> References: <364a2fe961ddce2c4668c0c8b78f46bffe2c2096.1679583701.git.mirai@makinata.eu> <877cv6yw5e.fsf@gmail.com> <6adedff0-30d3-c1c4-7b10-ece811f517ab@makinata.eu> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.46.0 MIME-Version: 1.0 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 (-) Am Samstag, dem 25.03.2023 um 00:33 +0000 schrieb Bruno Victal: > On 2023-03-24 16:03, Maxim Cournoyer wrote:> Bruno Victal > writes: > > > =C2=A0 > > > +;; XXX: These will shadow the previous definition used by mpd > > > +;;=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 and cause warnings to be shown. May= be split the file > > > +;;=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 into audio/mpd.scm and audio/mympd.= scm ? > > > +#;(define-maybe/no-serialization user-account) > > > +#;(define-maybe/no-serialization user-group) > >=20 > > I'd rather keeping them together if possible; could the prefix > > trick be > > used with them?=C2=A0 No need for a hanging indent for continued text, > > here > > and for the other occurrences. >=20 > The prefix trick is unlikely to help since the previous ones already > use it. > --8<---------------cut here---------------start------------->8--- > (define-maybe user-account (prefix mpd-)) > (define-maybe user-group (prefix mpd-)) > --8<---------------cut here---------------end--------------->8--- >=20 > I'm using define-maybe as a =E2=80=9Ccheat=E2=80=9D here for prettier doc= umentation > generation. > Without define-maybe, the documentation is rendered as: >=20 > --8<---------------cut here---------------start------------->8--- > @item @code{user} (type: user-account) > The user to run mpd as. > --8<---------------cut here---------------end--------------->8--- >=20 > =E2=80=A6 which is the documentation format for a field that requires an > explicit value, even though we are setting a default one using %mpd- > account. >=20 > On the other hand, using define-maybe yields: >=20 > --8<---------------cut here---------------start------------->8--- > @item @code{user} (type: maybe-user-account) > The user to run mpd as. > --8<---------------cut here---------------end--------------->8--- >=20 > =E2=80=A6 which is the format for fields that do not require any manual > intervention. This is a slight abuse of define-maybe, though. define-maybe communicates, that the field having no value, i.e. not even a default value, is acceptable. Since we always need a user to run MPD with, this makes no sense semantically. > > The expressions commented; should they be?=C2=A0 On another note, '#;' > > appears undocumented, I'd avoid it until it is (and it's not > > necessary > > here). >=20 > They're commented because the =E2=80=9Cright way of things=E2=80=9D would= have that > the first maybe-user-account is mpd-configuration specific due to > (prefix mpd-) and that we should have another maybe-user-account that > is unrelated. Since we require "explicit" users in both cases, I think we can work around this by dropping the maybe, no? Cheers From unknown Fri Jun 20 07:19:24 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#62298] [PATCH v2 1/8] services: configuration: Add user-defined sanitizer support. Resent-From: Maxim Cournoyer Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 26 Mar 2023 02:02:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 62298 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Liliana Marie Prikler Cc: 62298@debbugs.gnu.org, Bruno Victal , ludo@gnu.org Received: via spool by 62298-submit@debbugs.gnu.org id=B62298.167979607116264 (code B ref 62298); Sun, 26 Mar 2023 02:02:01 +0000 Received: (at 62298) by debbugs.gnu.org; 26 Mar 2023 02:01:11 +0000 Received: from localhost ([127.0.0.1]:43719 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pgFh0-0004EG-Su for submit@debbugs.gnu.org; Sat, 25 Mar 2023 22:01:11 -0400 Received: from mail-qt1-f174.google.com ([209.85.160.174]:36367) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pgFgz-0004E0-5k for 62298@debbugs.gnu.org; Sat, 25 Mar 2023 22:01:09 -0400 Received: by mail-qt1-f174.google.com with SMTP id hf2so5452631qtb.3 for <62298@debbugs.gnu.org>; Sat, 25 Mar 2023 19:01:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679796063; h=content-transfer-encoding:mime-version:user-agent:message-id :in-reply-to:date:references:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to; bh=OCG2xxP105PRWpMFcxIRnhocZjQgz/aDGCdAXRUM2JA=; b=R+/lAglrX3PcfS7F49ujH375mjXvhq6DpCnJYPIgVnwRBVWJ2d8JrwnwLDmJNjX3vP oefDd10PKIRmR9fDSSa9E8PnV0hZY21y/nefOHRu8R9IYKg35532RLmyeO8TSATKCN1B /qlV3qrs8My7ezQLXk7tiZlKw3n1DDtWoPB4otVADJjSb1IZP0L+/T0GqVzI5SEFEULc cbiNgXaAcKnl/yXHxVbvAyPvJz7p4XGHd6LXPupGZsm7yIjEoc2k26+6TPhGTqFRjVRA yy7wabEEu+H3EdydzazhcYMW6b3hurIgIAUNMy1OVAZKhZGmRM2rMChm3NHas4CzgIX7 8OpQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679796063; h=content-transfer-encoding:mime-version:user-agent:message-id :in-reply-to:date:references:subject:cc:to:from:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=OCG2xxP105PRWpMFcxIRnhocZjQgz/aDGCdAXRUM2JA=; b=pKS6t3CgI8YAIb5n49/2PE6nMn086rLj6LYG6L+F/O89dn66yWlQ3FnIanTpAqajGl V2fDK6RvNyzh4NpEs3fk9vTlWdz4WcEVeQjaS84CTWKvJIv/QZ1iu314TFGRIFpyFNrR bY8B+IRelRp7c8THi8+GrXaP9epq7SoNlv0fzgcwZndRTA4bxsCsE/Nq1JIiZjixFG/8 h/tW1XDyAOJWM3TvSZUppANguQ3nWmkmoad18Fn4ZN2ZZWc+8uIMf3SRJ2zWwkPTIp4+ fzKrVC/Le73Bfo/eH8nQ4PL+SVNBd0qSLhov1sN6dkYsHpBQzl559gibC4FjFsrF2Vg5 mbYg== X-Gm-Message-State: AO0yUKVll0X05kpaYYBMcNKDwU8yMXpTwE9tbmdzTUJCRyftoJI8fnez Kw7itMCA7OhpU7ZvfWfnP9QJ1pvAqrA= X-Google-Smtp-Source: AK7set/mdwaXOTsEI6Ux7Nd6t0GGdo4plHq1c2Q/MptT9TXdCIsG8o8i97NNQ9zUV4Itdl9vQL6Ahg== X-Received: by 2002:a05:622a:651:b0:3b9:b6e3:c78e with SMTP id a17-20020a05622a065100b003b9b6e3c78emr15459867qtb.8.1679796063629; Sat, 25 Mar 2023 19:01:03 -0700 (PDT) Received: from hurd (dsl-153-107.b2b2c.ca. [66.158.153.107]) by smtp.gmail.com with ESMTPSA id q43-20020a05620a2a6b00b0074860fcfc00sm164901qkp.136.2023.03.25.19.01.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 25 Mar 2023 19:01:03 -0700 (PDT) From: Maxim Cournoyer References: <87r0tez0ny.fsf@gmail.com> <90309cae7dc850a2008ddc67a797cb4ff4b3cb97.camel@gmail.com> Date: Sat, 25 Mar 2023 22:01:01 -0400 In-Reply-To: <90309cae7dc850a2008ddc67a797cb4ff4b3cb97.camel@gmail.com> (Liliana Marie Prikler's message of "Fri, 24 Mar 2023 19:03:06 +0100") Message-ID: <874jq8qnj6.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) 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: -1.0 (-) Hi, Liliana Marie Prikler writes: > Am Freitag, dem 24.03.2023 um 10:25 -0400 schrieb Maxim Cournoyer: >> > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ((proc)=C2=A0 ; TODO: depr= ecated, to be removed >> > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (every (cut eq? <> #= f) >> > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0 (map maybe-value-set? >> > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (list sanitizer* serial= izer*))) >>=20 >> This 'every' call result is not acted upon.=C2=A0 Was it supposed to rai= se >> a syntax violation?=C2=A0 If it's useful to keep it (and act on it), I'd >> use something like: > If I read this correctly, this 'every' call is actually in a guard > position, that is the syntax-case will ignore proc unless=20 Thanks for explaining -- Bruno had also hinted at this was a syntax-case guard on IRC, which I had forgotten about :-). --=20 Thanks, Maxim From unknown Fri Jun 20 07:19:24 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#62298] [PATCH v4 1/5] services: configuration: Add user-defined sanitizer support. References: In-Reply-To: Resent-From: Bruno Victal Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 26 Mar 2023 18:42:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 62298 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 62298@debbugs.gnu.org Cc: ludo@gnu.org, Bruno Victal , liliana.prikler@gmail.com, maxim.cournoyer@gmail.com Received: via spool by 62298-submit@debbugs.gnu.org id=B62298.167985610612066 (code B ref 62298); Sun, 26 Mar 2023 18:42:02 +0000 Received: (at 62298) by debbugs.gnu.org; 26 Mar 2023 18:41:46 +0000 Received: from localhost ([127.0.0.1]:45795 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pgVJJ-00038X-Mh for submit@debbugs.gnu.org; Sun, 26 Mar 2023 14:41:46 -0400 Received: from smtpm3.myservices.hosting ([185.26.105.234]:44162) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pgVJH-00038O-7L for 62298@debbugs.gnu.org; Sun, 26 Mar 2023 14:41:44 -0400 Received: from mail1.netim.hosting (unknown [185.26.106.173]) by smtpm3.myservices.hosting (Postfix) with ESMTP id 9389E20F41; Sun, 26 Mar 2023 20:41:41 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by mail1.netim.hosting (Postfix) with ESMTP id 391A680098; Sun, 26 Mar 2023 20:41:38 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at mail1.netim.hosting Received: from mail1.netim.hosting ([127.0.0.1]) by localhost (mail1-2.netim.hosting [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id KjCJPIfyriOz; Sun, 26 Mar 2023 20:41:37 +0200 (CEST) Received: from guix-nuc.home.arpa (bl9-119-177.dsl.telepac.pt [85.242.119.177]) (Authenticated sender: lumen@makinata.eu) by mail1.netim.hosting (Postfix) with ESMTPSA id 401EE80097; Sun, 26 Mar 2023 20:41:37 +0200 (CEST) From: Bruno Victal Date: Sun, 26 Mar 2023 19:41:29 +0100 Message-Id: X-Mailer: git-send-email 2.39.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 (-) This changes the 'custom-serializer' field into a generic 'extra-args' field that can be extended to support new literals. With this mechanism, the literals 'sanitizer' allow for user-defined sanitizer procedures while the 'serializer' literal is used for custom serializer procedures. The 'empty-serializer' was also added as a 'literal' and can be used just like it was previously. With the repurposing of 'custom-serializer' into 'extra-args', to prevent intolerable confusion, the custom serializer procedures should be specified using the new 'literals' approach, with the previous “style” being considered deprecated. * gnu/services/configuration.scm (define-configuration-helper): Rename 'custom-serializer' to 'extra-args'. Add support for literals 'sanitizer', 'serializer' and 'empty-serializer'. Rename procedure 'field-sanitizer' to 'default-field-sanitizer' to avoid syntax clash. Only define default field sanitizers if user-defined ones are absent. (normalize-extra-args): New procedure. ()[sanitizer]: New field. * doc/guix.texi (Complex Configurations): Document the newly added literals. * tests/services/configuration.scm: Add tests for the new literals. --- Notable changes from v3 to v4: * Removed define-maybe usage for user-account and user-group. doc/guix.texi | 29 ++++- gnu/services/configuration.scm | 90 +++++++++++---- tests/services/configuration.scm | 183 ++++++++++++++++++++++++++++++- 3 files changed, 276 insertions(+), 26 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index 3e335306f1..8604b95f94 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -41216,7 +41216,7 @@ Complex Configurations (@var{field-name} (@var{type} @var{default-value}) @var{documentation} - @var{serializer}) + (serializer @var{serializer})) (@var{field-name} (@var{type}) @@ -41225,7 +41225,18 @@ Complex Configurations (@var{field-name} (@var{type}) @var{documentation} - @var{serializer}) + (serializer @var{serializer})) + +(@var{field-name} + (@var{type}) + @var{documentation} + (sanitizer @var{sanitizer}) + +(@var{field-name} + (@var{type}) + @var{documentation} + (sanitizer @var{sanitizer}) + (serializer @var{serializer})) @end example @var{field-name} is an identifier that denotes the name of the field in @@ -41248,6 +41259,20 @@ Complex Configurations @var{documentation} is a string formatted with Texinfo syntax which should provide a description of what setting this field does. +@var{sanitizer} is a procedure which takes one argument, +a user-supplied value, and returns a ``sanitized'' value for the field. +If no sanitizer is specified, a default sanitizer is used, which raises +an error if the value is not of type @var{type}. + +An example of a sanitizer for a field that accepts both strings and +symbols looks like this: +@lisp +(define (sanitize-foo value) + (cond ((string? value) value) + ((symbol? value) (symbol->string value)) + (else (error "bad value")))) +@end lisp + @var{serializer} is the name of a procedure which takes two arguments, the first is the name of the field, and the second is the value corresponding to the field. The procedure should return a string or diff --git a/gnu/services/configuration.scm b/gnu/services/configuration.scm index 174c2f20d2..880eba8138 100644 --- a/gnu/services/configuration.scm +++ b/gnu/services/configuration.scm @@ -6,6 +6,7 @@ ;;; Copyright © 2021, 2022 Maxim Cournoyer ;;; Copyright © 2021 Andrew Tropin ;;; Copyright © 2022 Maxime Devos +;;; Copyright © 2023 Bruno Victal ;;; ;;; This file is part of GNU Guix. ;;; @@ -28,7 +29,8 @@ (define-module (gnu services configuration) #:use-module (guix gexp) #:use-module ((guix utils) #:select (source-properties->location)) #:use-module ((guix diagnostics) - #:select (formatted-message location-file &error-location)) + #:select (formatted-message location-file &error-location + warning)) #:use-module ((guix modules) #:select (file-name->module-name)) #:use-module (guix i18n) #:autoload (texinfo) (texi-fragment->stexi) @@ -37,6 +39,7 @@ (define-module (gnu services configuration) #:use-module (ice-9 format) #:use-module (ice-9 match) #:use-module (srfi srfi-1) + #:use-module (srfi srfi-26) #:use-module (srfi srfi-34) #:use-module (srfi srfi-35) #:export (configuration-field @@ -44,6 +47,7 @@ (define-module (gnu services configuration) configuration-field-type configuration-missing-field configuration-field-error + configuration-field-sanitizer configuration-field-serializer configuration-field-getter configuration-field-default-value-thunk @@ -116,6 +120,7 @@ (define-record-type* (type configuration-field-type) (getter configuration-field-getter) (predicate configuration-field-predicate) + (sanitizer configuration-field-sanitizer) (serializer configuration-field-serializer) (default-value-thunk configuration-field-default-value-thunk) (documentation configuration-field-documentation)) @@ -181,11 +186,44 @@ (define (normalize-field-type+def s) (values #'(field-type %unset-value))))) (define (define-configuration-helper serialize? serializer-prefix syn) + + (define (normalize-extra-args s) + "Extract and normalize arguments following @var{doc}." + (let loop ((s s) + (sanitizer* %unset-value) + (serializer* %unset-value)) + (syntax-case s (sanitizer serializer empty-serializer) + (((sanitizer proc) tail ...) + (if (maybe-value-set? sanitizer*) + (syntax-violation 'sanitizer "duplicate entry" + #'proc) + (loop #'(tail ...) #'proc serializer*))) + (((serializer proc) tail ...) + (if (maybe-value-set? serializer*) + (syntax-violation 'serializer "duplicate or conflicting entry" + #'proc) + (loop #'(tail ...) sanitizer* #'proc))) + ((empty-serializer tail ...) + (if (maybe-value-set? serializer*) + (syntax-violation 'empty-serializer + "duplicate or conflicting entry" #f) + (loop #'(tail ...) sanitizer* #'empty-serializer))) + (() ; stop condition + (values (list sanitizer* serializer*))) + ((proc) ; TODO: deprecated, to be removed. + (null? (filter-map maybe-value-set? (list sanitizer* serializer*))) + (begin + (warning #f (G_ "specifying serializers after documentation is \ +deprecated, use (serializer ~a) instead~%") (syntax->datum #'proc)) + (values (list %unset-value #'proc))))))) + (syntax-case syn () - ((_ stem (field field-type+def doc custom-serializer ...) ...) + ((_ stem (field field-type+def doc extra-args ...) ...) (with-syntax ((((field-type def) ...) - (map normalize-field-type+def #'(field-type+def ...)))) + (map normalize-field-type+def #'(field-type+def ...))) + (((sanitizer* serializer*) ...) + (map normalize-extra-args #'((extra-args ...) ...)))) (with-syntax (((field-getter ...) (map (lambda (field) @@ -200,21 +238,18 @@ (define (define-configuration-helper serialize? serializer-prefix syn) ((field-type default-value) default-value)) #'((field-type def) ...))) + ((field-sanitizer ...) + (map maybe-value #'(sanitizer* ...))) ((field-serializer ...) - (map (lambda (type custom-serializer) + (map (lambda (type proc) (and serialize? - (match custom-serializer - ((serializer) - serializer) - (() - (if serializer-prefix - (id #'stem - serializer-prefix - #'serialize- type) - (id #'stem #'serialize- type)))))) + (or (maybe-value proc) + (if serializer-prefix + (id #'stem serializer-prefix #'serialize- type) + (id #'stem #'serialize- type))))) #'(field-type ...) - #'((custom-serializer ...) ...)))) - (define (field-sanitizer name pred) + #'(serializer* ...)))) + (define (default-field-sanitizer name pred) ;; Define a macro for use as a record field sanitizer, where NAME ;; is the name of the field and PRED is the predicate that tells ;; whether a value is valid for this field. @@ -235,21 +270,29 @@ (define (define-configuration-helper serialize? serializer-prefix syn) #`(begin ;; Define field validation macros. - #,@(map field-sanitizer - #'(field ...) - #'(field-predicate ...)) + #,@(filter-map (lambda (name pred sanitizer) + (if sanitizer + #f + (default-field-sanitizer name pred))) + #'(field ...) + #'(field-predicate ...) + #'(field-sanitizer ...)) (define-record-type* #,(id #'stem #'< #'stem #'>) stem #,(id #'stem #'make- #'stem) #,(id #'stem #'stem #'?) - #,@(map (lambda (name getter def) - #`(#,name #,getter (default #,def) + #,@(map (lambda (name getter def sanitizer) + #`(#,name #,getter + (default #,def) (sanitize - #,(id #'stem #'validate- #'stem #'- name)))) + #,(or sanitizer + (id #'stem + #'validate- #'stem #'- name))))) #'(field ...) #'(field-getter ...) - #'(field-default ...)) + #'(field-default ...) + #'(field-sanitizer ...)) (%location #,(id #'stem #'stem #'-source-location) (default (and=> (current-source-location) source-properties->location)) @@ -261,6 +304,9 @@ (define (define-configuration-helper serialize? serializer-prefix syn) (type 'field-type) (getter field-getter) (predicate field-predicate) + (sanitizer + (or field-sanitizer + (id #'stem #'validate- #'stem #'- #'field))) (serializer field-serializer) (default-value-thunk (lambda () diff --git a/tests/services/configuration.scm b/tests/services/configuration.scm index 4f8a74dc8a..0392cce927 100644 --- a/tests/services/configuration.scm +++ b/tests/services/configuration.scm @@ -2,6 +2,7 @@ ;;; Copyright © 2021, 2022 Maxim Cournoyer ;;; Copyright © 2021 Xinglu Chen ;;; Copyright © 2022 Ludovic Courtès +;;; Copyright © 2023 Bruno Victal ;;; ;;; This file is part of GNU Guix. ;;; @@ -22,6 +23,7 @@ (define-module (tests services configuration) #:use-module (gnu services configuration) #:use-module (guix diagnostics) #:use-module (guix gexp) + #:autoload (guix i18n) (G_) #:use-module (srfi srfi-34) #:use-module (srfi srfi-64)) @@ -46,14 +48,14 @@ (define-configuration port-configuration (port-configuration-port (port-configuration))) (test-equal "wrong type for a field" - '("configuration.scm" 57 11) ;error location + '("configuration.scm" 59 11) ;error location (guard (c ((configuration-error? c) (let ((loc (error-location c))) (list (basename (location-file loc)) (location-line loc) (location-column loc))))) (port-configuration - ;; This is line 56; the test relies on line/column numbers! + ;; This is line 58; the test relies on line/column numbers! (port "This is not a number!")))) (define-configuration port-configuration-cs @@ -109,6 +111,183 @@ (define-configuration configuration-with-prefix (let ((config (configuration-with-prefix))) (serialize-configuration config configuration-with-prefix-fields)))) + +;;; +;;; define-configuration macro, extra-args literals +;;; + +(define (eval-gexp x) + "Get serialized config as string." + (eval (gexp->approximate-sexp x) + (current-module))) + +(define (port? value) + (or (string? value) (number? value))) + +(define (sanitize-port value) + (cond ((number? value) value) + ((string? value) (string->number value)) + (else (raise (formatted-message (G_ "Bad value: ~a") value))))) + +(test-group "Basic sanitizer literal tests" + (define serialize-port serialize-number) + + (define-configuration config-with-sanitizer + (port + (port 80) + "Lorem Ipsum." + (sanitizer sanitize-port))) + + (test-equal "default value, sanitizer" + 80 + (config-with-sanitizer-port (config-with-sanitizer))) + + (test-equal "string value, sanitized to number" + 56 + (config-with-sanitizer-port (config-with-sanitizer + (port "56")))) + + (define (custom-serialize-port field-name value) + (number->string value)) + + (define-configuration config-serializer + (port + (port 80) + "Lorem Ipsum." + (serializer custom-serialize-port))) + + (test-equal "default value, serializer literal" + "80" + (eval-gexp + (serialize-configuration (config-serializer) + config-serializer-fields)))) + +(test-group "empty-serializer as literal/procedure tests" + (define-configuration config-with-literal + (port + (port 80) + "Lorem Ipsum." + empty-serializer)) + + (define-configuration config-with-proc + (port + (port 80) + "Lorem Ipsum." + (serializer empty-serializer))) + + (test-equal "empty-serializer as literal" + "" + (eval-gexp + (serialize-configuration (config-with-literal) + config-with-literal-fields))) + + (test-equal "empty-serializer as procedure" + "" + (eval-gexp + (serialize-configuration (config-with-proc) + config-with-proc-fields)))) + +(test-group "permutation tests" + (define-configuration config-san+empty-ser + (port + (port 80) + "Lorem Ipsum." + (sanitizer sanitize-port) + empty-serializer)) + + (define-configuration config-san+ser + (port + (port 80) + "Lorem Ipsum." + (sanitizer sanitize-port) + (serializer (lambda _ "foo")))) + + (test-equal "default value, sanitizer, permutation" + 80 + (config-san+empty-ser-port (config-san+empty-ser))) + + (test-equal "default value, serializer, permutation" + "foo" + (eval-gexp + (serialize-configuration (config-san+ser) config-san+ser-fields))) + + (test-equal "string value sanitized to number, permutation" + 56 + (config-san+ser-port (config-san+ser + (port "56")))) + + ;; Ordering tests. + (define-configuration config-ser+san + (port + (port 80) + "Lorem Ipsum." + (sanitizer sanitize-port) + (serializer (lambda _ "foo")))) + + (define-configuration config-empty-ser+san + (port + (port 80) + "Lorem Ipsum." + empty-serializer + (sanitizer sanitize-port))) + + (test-equal "default value, sanitizer, permutation 2" + 56 + (config-empty-ser+san-port (config-empty-ser+san + (port "56")))) + + (test-equal "default value, serializer, permutation 2" + "foo" + (eval-gexp + (serialize-configuration (config-ser+san) config-ser+san-fields)))) + +(test-group "duplicated/conflicting entries" + (test-error + "duplicate sanitizer" #t + (macroexpand '(define-configuration dupe-san + (foo + (list '()) + "Lorem Ipsum." + (sanitizer (lambda () #t)) + (sanitizer (lambda () #t)))))) + + (test-error + "duplicate serializer" #t + (macroexpand '(define-configuration dupe-ser + (foo + (list '()) + "Lorem Ipsum." + (serializer (lambda _ "")) + (serializer (lambda _ "")))))) + + (test-error + "conflicting use of serializer + empty-serializer" #t + (macroexpand '(define-configuration ser+empty-ser + (foo + (list '()) + "Lorem Ipsum." + (serializer (lambda _ "lorem")) + empty-serializer))))) + +(test-group "Mix of deprecated and new syntax" + (test-error + "Mix of bare serializer and new syntax" #t + (macroexpand '(define-configuration mixed + (foo + (list '()) + "Lorem Ipsum." + (sanitizer (lambda () #t)) + (lambda _ "lorem"))))) + + (test-error + "Mix of bare serializer and new syntax, permutation)" #t + (macroexpand '(define-configuration mixed + (foo + (list '()) + "Lorem Ipsum." + (lambda _ "lorem") + (sanitizer (lambda () #t))))))) + ;;; ;;; define-maybe macro. -- 2.39.1 From unknown Fri Jun 20 07:19:24 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#62298] [PATCH v4 3/5] services: mpd: Fix unintentional API breakage for mixer-type field. Resent-From: Bruno Victal Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 26 Mar 2023 18:43:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 62298 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 62298@debbugs.gnu.org Cc: ludo@gnu.org, Bruno Victal , liliana.prikler@gmail.com, maxim.cournoyer@gmail.com Received: via spool by 62298-submit@debbugs.gnu.org id=B62298.167985615712169 (code B ref 62298); Sun, 26 Mar 2023 18:43:01 +0000 Received: (at 62298) by debbugs.gnu.org; 26 Mar 2023 18:42:37 +0000 Received: from localhost ([127.0.0.1]:45801 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pgVK8-0003A2-QC for submit@debbugs.gnu.org; Sun, 26 Mar 2023 14:42:37 -0400 Received: from smtpm5.myservices.hosting ([185.26.105.236]:59332) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pgVK7-00039r-Ff for 62298@debbugs.gnu.org; Sun, 26 Mar 2023 14:42:35 -0400 Received: from mail1.netim.hosting (unknown [185.26.106.173]) by smtpm5.myservices.hosting (Postfix) with ESMTP id F37F020CED; Sun, 26 Mar 2023 20:42:33 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by mail1.netim.hosting (Postfix) with ESMTP id 937A280097; Sun, 26 Mar 2023 20:42:33 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at mail1.netim.hosting Received: from mail1.netim.hosting ([127.0.0.1]) by localhost (mail1-2.netim.hosting [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id yu3eC5vG5Qid; Sun, 26 Mar 2023 20:42:33 +0200 (CEST) Received: from guix-nuc.home.arpa (bl9-119-177.dsl.telepac.pt [85.242.119.177]) (Authenticated sender: lumen@makinata.eu) by mail1.netim.hosting (Postfix) with ESMTPSA id EC4E280098; Sun, 26 Mar 2023 20:42:32 +0200 (CEST) From: Bruno Victal Date: Sun, 26 Mar 2023 19:41:31 +0100 Message-Id: <51fec2a2060a2f6f3da0a83775b0e85402581db4.1679855983.git.mirai@makinata.eu> X-Mailer: git-send-email 2.39.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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/audio.scm (mpd-output)[mixer-type]: Use sanitizer to accept both strings and symbols as values. --- gnu/services/audio.scm | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/gnu/services/audio.scm b/gnu/services/audio.scm index c073b85a32..bc4aed71dc 100644 --- a/gnu/services/audio.scm +++ b/gnu/services/audio.scm @@ -140,6 +140,11 @@ (define (uglify-field-name field-name) (define list-of-symbol? (list-of symbol?)) + +;;; +;;; MPD +;;; + (define (mpd-serialize-field field-name value) (let ((field (if (string? field-name) field-name (uglify-field-name field-name))) @@ -294,7 +299,17 @@ (define-configuration mpd-output for this audio output: the @code{hardware} mixer, the @code{software} mixer, the @code{null} mixer (allows setting the volume, but with no effect; this can be used as a trick to implement an external mixer -External Mixer) or no mixer (@code{none}).") +External Mixer) or no mixer (@code{none})." + (sanitizer + (lambda (x) ; TODO: deprecated, remove me later. + (cond + ((symbol? x) + (warning (G_ "symbol value for 'mixer-type' is deprecated, \ +use string instead~%")) + (symbol->string x)) + ((string? x) x) + (else + (configuration-field-error #f 'mixer-type x)))))) (replay-gain-handler maybe-string -- 2.39.1 From unknown Fri Jun 20 07:19:24 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#62298] [PATCH v4 4/5] services: mpd: Use user-account (resp. user-group) for user (resp. group) fields. Resent-From: Bruno Victal Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 26 Mar 2023 18:43:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 62298 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 62298@debbugs.gnu.org Cc: ludo@gnu.org, Bruno Victal , liliana.prikler@gmail.com, maxim.cournoyer@gmail.com Received: via spool by 62298-submit@debbugs.gnu.org id=B62298.167985616112182 (code B ref 62298); Sun, 26 Mar 2023 18:43:02 +0000 Received: (at 62298) by debbugs.gnu.org; 26 Mar 2023 18:42:41 +0000 Received: from localhost ([127.0.0.1]:45803 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pgVKC-0003AN-Fa for submit@debbugs.gnu.org; Sun, 26 Mar 2023 14:42:41 -0400 Received: from smtpmciv4.myservices.hosting ([185.26.107.240]:42056) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pgVK8-00039t-7W for 62298@debbugs.gnu.org; Sun, 26 Mar 2023 14:42:36 -0400 Received: from mail1.netim.hosting (unknown [185.26.106.173]) by smtpmciv4.myservices.hosting (Postfix) with ESMTP id 8A51920909; Sun, 26 Mar 2023 20:42:34 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by mail1.netim.hosting (Postfix) with ESMTP id 34B9B8009C; Sun, 26 Mar 2023 20:42:34 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at mail1.netim.hosting Received: from mail1.netim.hosting ([127.0.0.1]) by localhost (mail1-2.netim.hosting [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id FW8j1h0zTaIM; Sun, 26 Mar 2023 20:42:33 +0200 (CEST) Received: from guix-nuc.home.arpa (bl9-119-177.dsl.telepac.pt [85.242.119.177]) (Authenticated sender: lumen@makinata.eu) by mail1.netim.hosting (Postfix) with ESMTPSA id 759B98009B; Sun, 26 Mar 2023 20:42:33 +0200 (CEST) From: Bruno Victal Date: Sun, 26 Mar 2023 19:41:32 +0100 Message-Id: X-Mailer: git-send-email 2.39.1 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 (-) Deprecate using strings for these fields and prefer user-account (resp. user-group) instead to avoid duplication within account-service-type. Fixes #61570 . * gnu/services/audio.scm (mpd-serialize-user-account, mpd-serialize-user-group) (mpd-user-sanitizer, mpd-group-sanitizer): New procedure. (%mpd-user, %mpd-group): New variable. (mpd-configuration)[user, group]: Set value type to user-account (resp. user-group). (mpd-shepherd-service): Adapt for user-account values in user field. (mpd-accounts): Adapt for user-account (resp. user-group) in user (resp. group) field. * doc/guix.texi (Audio Services): Update documentation. --- doc/guix.texi | 4 +- gnu/services/audio.scm | 87 +++++++++++++++++++++++++++++++++--------- 2 files changed, 72 insertions(+), 19 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index 8604b95f94..ff678ca6ec 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -33491,10 +33491,10 @@ Audio Services @item @code{package} (default: @code{mpd}) (type: file-like) The MPD package. -@item @code{user} (default: @code{"mpd"}) (type: string) +@item @code{user} (type: user-account) (optional) The user to run mpd as. -@item @code{group} (default: @code{"mpd"}) (type: string) +@item @code{group} (type: user-group) (optional) The group to run mpd as. @item @code{shepherd-requirement} (default: @code{()}) (type: list-of-symbol) diff --git a/gnu/services/audio.scm b/gnu/services/audio.scm index bc4aed71dc..3fd309e45d 100644 --- a/gnu/services/audio.scm +++ b/gnu/services/audio.scm @@ -140,6 +140,14 @@ (define (uglify-field-name field-name) (define list-of-symbol? (list-of symbol?)) +;; Helpers for deprecated field types, to be removed later. +(define %lazy-group (make-symbol "%lazy-group")) + +(define (inject-group-into-user user group) + (user-account + (inherit user) + (group (user-group-name group)))) + ;;; ;;; MPD @@ -164,10 +172,31 @@ (define mpd-serialize-boolean mpd-serialize-field) (define (mpd-serialize-list-of-strings field-name value) #~(string-append #$@(map (cut mpd-serialize-string field-name <>) value))) +(define (mpd-serialize-user-account field-name value) + (mpd-serialize-string field-name (user-account-name value))) + +(define (mpd-serialize-user-group field-name value) + (mpd-serialize-string field-name (user-group-name value))) + (define-maybe string (prefix mpd-)) (define-maybe list-of-strings (prefix mpd-)) (define-maybe boolean (prefix mpd-)) +(define %mpd-user + (user-account + (name "mpd") + (group "mpd") + (system? #t) + (comment "Music Player Daemon (MPD) user") + ;; MPD can use $HOME (or $XDG_CONFIG_HOME) to place its data + (home-directory "/var/lib/mpd") + (shell (file-append shadow "/sbin/nologin")))) + +(define %mpd-group + (user-group + (name "mpd") + (system? #t))) + ;;; TODO: Procedures for deprecated fields, to be removed. (define mpd-deprecated-fields '((music-dir . music-directory) @@ -197,6 +226,33 @@ (define (mpd-serialize-port field-name value) (define-maybe port (prefix mpd-)) +;;; Procedures for unsupported value types, to be removed. + +(define (mpd-user-sanitizer value) + (cond ((user-account? value) value) + ((string? value) + (warning (G_ "string value for 'user' is deprecated, use \ +user-account instead~%")) + (user-account + (inherit %mpd-user) + (name value) + ;; XXX: This is to be lazily substituted in (…-accounts) + ;; with the value from 'group'. + (group %lazy-group))) + (else + (configuration-field-error #f 'user value)))) + +(define (mpd-group-sanitizer value) + (cond ((user-group? value) value) + ((string? value) + (warning (G_ "string value for 'group' is deprecated, use \ +user-group instead~%")) + (user-group + (inherit %mpd-group) + (name value))) + (else + (configuration-field-error #f 'group value)))) + ;;; ;; Generic MPD plugin record, lists only the most prevalent fields. @@ -347,12 +403,14 @@ (define-configuration mpd-configuration empty-serializer) (user - (string "mpd") - "The user to run mpd as.") + (user-account %mpd-user) + "The user to run mpd as." + (sanitizer mpd-user-sanitizer)) (group - (string "mpd") - "The group to run mpd as.") + (user-group %mpd-group) + "The group to run mpd as." + (sanitizer mpd-group-sanitizer)) (shepherd-requirement (list-of-symbol '()) @@ -517,7 +575,8 @@ (define (mpd-shepherd-service config) log-file playlist-directory db-file state-file sticker-file environment-variables) - (let* ((config-file (mpd-serialize-configuration config))) + (let ((config-file (mpd-serialize-configuration config)) + (username (user-account-name user))) (shepherd-service (documentation "Run the MPD (Music Player Daemon)") (requirement `(user-processes loopback ,@shepherd-requirement)) @@ -526,7 +585,7 @@ (define (mpd-shepherd-service config) (and=> #$(maybe-value log-file) (compose mkdir-p dirname)) - (let ((user (getpw #$user))) + (let ((user (getpw #$username))) (for-each (lambda (x) (when (and x (not (file-exists? x))) @@ -560,17 +619,11 @@ (define (mpd-shepherd-service config) (define (mpd-accounts config) (match-record config (user group) - (list (user-group - (name group) - (system? #t)) - (user-account - (name user) - (group group) - (system? #t) - (comment "Music Player Daemon (MPD) user") - ;; MPD can use $HOME (or $XDG_CONFIG_HOME) to place its data - (home-directory "/var/lib/mpd") - (shell (file-append shadow "/sbin/nologin")))))) + ;; TODO: Deprecation code, to be removed. + (let ((user (if (eq? (user-account-group user) %lazy-group) + (inject-group-into-user user group) + user))) + (list user group)))) (define mpd-service-type (service-type -- 2.39.1 From unknown Fri Jun 20 07:19:24 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#62298] [PATCH v4 5/5] services: mympd: Use user-account (resp. user-group) for user (resp. group) fields. Resent-From: Bruno Victal Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 26 Mar 2023 18:43:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 62298 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 62298@debbugs.gnu.org Cc: ludo@gnu.org, Bruno Victal , liliana.prikler@gmail.com, maxim.cournoyer@gmail.com Received: via spool by 62298-submit@debbugs.gnu.org id=B62298.167985616112188 (code B ref 62298); Sun, 26 Mar 2023 18:43:02 +0000 Received: (at 62298) by debbugs.gnu.org; 26 Mar 2023 18:42:41 +0000 Received: from localhost ([127.0.0.1]:45805 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pgVKD-0003AR-5C for submit@debbugs.gnu.org; Sun, 26 Mar 2023 14:42:41 -0400 Received: from smtpmciv1.myservices.hosting ([185.26.107.237]:50398) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pgVK8-00039u-98 for 62298@debbugs.gnu.org; Sun, 26 Mar 2023 14:42:37 -0400 Received: from mail1.netim.hosting (unknown [185.26.106.173]) by smtpmciv1.myservices.hosting (Postfix) with ESMTP id ED04120DCE; Sun, 26 Mar 2023 20:42:34 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by mail1.netim.hosting (Postfix) with ESMTP id A0E698009B; Sun, 26 Mar 2023 20:42:34 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at mail1.netim.hosting Received: from mail1.netim.hosting ([127.0.0.1]) by localhost (mail1-2.netim.hosting [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id DNVNKgaByxpr; Sun, 26 Mar 2023 20:42:34 +0200 (CEST) Received: from guix-nuc.home.arpa (bl9-119-177.dsl.telepac.pt [85.242.119.177]) (Authenticated sender: lumen@makinata.eu) by mail1.netim.hosting (Postfix) with ESMTPSA id F390D80098; Sun, 26 Mar 2023 20:42:33 +0200 (CEST) From: Bruno Victal Date: Sun, 26 Mar 2023 19:41:33 +0100 Message-Id: <67074783f51cf8e2d4688f1084f7bb38f5846c40.1679855983.git.mirai@makinata.eu> X-Mailer: git-send-email 2.39.1 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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/audio.scm (%mympd-user, %mympd-group): New variable. (mympd-user-sanitizer, mympd-group-sanitizer): New procedure. (mympd-configuration)[user, group]: Set value type to user-account (resp. user-group). (mympd-serialize-configuration): Adapt for user-account values in user field. (mympd-accounts): Adapt for user-account (resp. user-group) in user (resp. group) field. --- doc/guix.texi | 4 +-- gnu/services/audio.scm | 70 +++++++++++++++++++++++++++++++++--------- 2 files changed, 58 insertions(+), 16 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index ff678ca6ec..7695e000a8 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -33732,10 +33732,10 @@ Audio Services This is a list of symbols naming Shepherd services that this service will depend on. -@item @code{user} (default: @code{"mympd"}) (type: string) +@item @code{user} (type: user-account) (optional) Owner of the @command{mympd} process. -@item @code{group} (default: @code{"nogroup"}) (type: string) +@item @code{group} (type: user-group) (optional) Owner group of the @command{mympd} process. @item @code{work-directory} (default: @code{"/var/lib/mympd"}) (type: string) diff --git a/gnu/services/audio.scm b/gnu/services/audio.scm index 3fd309e45d..76da67944a 100644 --- a/gnu/services/audio.scm +++ b/gnu/services/audio.scm @@ -658,6 +658,48 @@ (define-configuration/no-serialization mympd-ip-acl (define-maybe/no-serialization integer) (define-maybe/no-serialization mympd-ip-acl) +(define %mympd-user + (user-account + (name "mympd") + (group "mympd") + (system? #t) + (comment "myMPD user") + (home-directory "/var/empty") + (shell (file-append shadow "/sbin/nologin")))) + +(define %mympd-group + (user-group + (name "mympd") + (system? #t))) + +;;; TODO: Procedures for unsupported value types, to be removed. +(define (mympd-user-sanitizer value) + (cond ((user-account? value) value) + ((string? value) + (warning (G_ "string value for 'user' is not supported, use \ +user-account instead~%")) + (user-account + (inherit %mympd-user) + (name value) + ;; XXX: this is to be lazily substituted in (…-accounts) + ;; with the value from 'group'. + (group %lazy-group))) + (else + (configuration-field-error #f 'user value)))) + +(define (mympd-group-sanitizer value) + (cond ((user-group? value) value) + ((string? value) + (warning (G_ "string value for 'group' is not supported, use \ +user-group instead~%")) + (user-group + (inherit %mympd-group) + (name value))) + (else + (configuration-field-error #f 'group value)))) +;;; + + ;; XXX: The serialization procedures are insufficient since we require ;; access to multiple fields at once. ;; Fields marked with empty-serializer are never serialized and are @@ -675,13 +717,15 @@ (define-configuration/no-serialization mympd-configuration empty-serializer) (user - (string "mympd") + (user-account %mympd-user) "Owner of the @command{mympd} process." + (sanitizer mympd-user-sanitizer) empty-serializer) (group - (string "nogroup") + (user-group %mympd-group) "Owner group of the @command{mympd} process." + (sanitizer mympd-group-sanitizer) empty-serializer) (work-directory @@ -816,7 +860,8 @@ (define (mympd-shepherd-service config) (match-record config (package shepherd-requirement user work-directory cache-directory log-level log-to) - (let ((log-level* (format #f "MYMPD_LOGLEVEL=~a" log-level))) + (let ((log-level* (format #f "MYMPD_LOGLEVEL=~a" log-level)) + (username (user-account-name user))) (shepherd-service (documentation "Run the myMPD daemon.") (requirement `(loopback user-processes @@ -826,7 +871,7 @@ (define (mympd-shepherd-service config) ,@shepherd-requirement)) (provision '(mympd)) (start #~(begin - (let* ((pw (getpwnam #$user)) + (let* ((pw (getpwnam #$username)) (uid (passwd:uid pw)) (gid (passwd:gid pw))) (for-each (lambda (dir) @@ -836,8 +881,8 @@ (define (mympd-shepherd-service config) (make-forkexec-constructor `(#$(file-append package "/bin/mympd") - "--user" #$user - #$@(if (eqv? log-to 'syslog) '("--syslog") '()) + "--user" #$username + #$@(if (eq? log-to 'syslog) '("--syslog") '()) "--workdir" #$work-directory "--cachedir" #$cache-directory) #:environment-variables (list #$log-level*) @@ -846,14 +891,11 @@ (define (mympd-shepherd-service config) (define (mympd-accounts config) (match-record config (user group) - (list (user-group (name group) - (system? #t)) - (user-account (name user) - (group group) - (system? #t) - (comment "myMPD user") - (home-directory "/var/empty") - (shell (file-append shadow "/sbin/nologin")))))) + ;; TODO: Deprecation code, to be removed. + (let ((user (if (eq? (user-account-group user) %lazy-group) + (inject-group-into-user user group) + user))) + (list user group)))) (define (mympd-log-rotation config) (match-record config (log-to) -- 2.39.1 From unknown Fri Jun 20 07:19:24 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#62298] [PATCH v4 2/5] services: replace bare serializers with (serializer ...) Resent-From: Bruno Victal Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 26 Mar 2023 18:43:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 62298 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 62298@debbugs.gnu.org Cc: ludo@gnu.org, Bruno Victal , liliana.prikler@gmail.com, maxim.cournoyer@gmail.com Received: via spool by 62298-submit@debbugs.gnu.org id=B62298.167985616812208 (code B ref 62298); Sun, 26 Mar 2023 18:43:02 +0000 Received: (at 62298) by debbugs.gnu.org; 26 Mar 2023 18:42:48 +0000 Received: from localhost ([127.0.0.1]:45808 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pgVKJ-0003Aq-LE for submit@debbugs.gnu.org; Sun, 26 Mar 2023 14:42:48 -0400 Received: from smtpm2.myservices.hosting ([185.26.105.233]:34018) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pgVKD-0003AP-Gr for 62298@debbugs.gnu.org; Sun, 26 Mar 2023 14:42:42 -0400 Received: from mail1.netim.hosting (unknown [185.26.106.173]) by smtpm2.myservices.hosting (Postfix) with ESMTP id E54D020EF2; Sun, 26 Mar 2023 20:42:39 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by mail1.netim.hosting (Postfix) with ESMTP id 662898009A; Sun, 26 Mar 2023 20:42:33 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at mail1.netim.hosting Received: from mail1.netim.hosting ([127.0.0.1]) by localhost (mail1-2.netim.hosting [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id aB5U5bRPN60S; Sun, 26 Mar 2023 20:42:32 +0200 (CEST) Received: from guix-nuc.home.arpa (bl9-119-177.dsl.telepac.pt [85.242.119.177]) (Authenticated sender: lumen@makinata.eu) by mail1.netim.hosting (Postfix) with ESMTPSA id 6FE9B80097; Sun, 26 Mar 2023 20:42:32 +0200 (CEST) From: Bruno Victal Date: Sun, 26 Mar 2023 19:41:30 +0100 Message-Id: <5512c499b2954f41f416bd2748d6c1f7687dea68.1679855983.git.mirai@makinata.eu> X-Mailer: git-send-email 2.39.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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/home/services/shells.scm (home-zsh-configuration)[environment-variables]: Use (serializer ...). (home-bash-configuration)[aliases, environment-variables]: Ditto. (home-fish-configuration)[abbreviations, aliases, environment-variables]: Ditto. * gnu/services/audio.scm (mpd-configuration)[music-dir, playlist-dir, endpoints] [address, inputs, archive-plugins, input-cache-size, decoders, filters] [playlist-plugins]: Ditto. * gnu/services/linux.scm (fstrim-configuration)[extra-arguments]: Ditto. * gnu/services/security.scm (fail2ban-jail-configuration)[backend, log-encoding] [extra-content]: Ditto. * tests/services/configuration.scm: Update tests. Add test for deprecated bare serializers. --- gnu/home/services/shells.scm | 12 ++++----- gnu/services/audio.scm | 45 ++++++++++++++++---------------- gnu/services/linux.scm | 7 ++--- gnu/services/security.scm | 6 ++--- tests/services/configuration.scm | 11 +++++++- 5 files changed, 46 insertions(+), 35 deletions(-) diff --git a/gnu/home/services/shells.scm b/gnu/home/services/shells.scm index 3326eb37f4..f05f2221d6 100644 --- a/gnu/home/services/shells.scm +++ b/gnu/home/services/shells.scm @@ -133,7 +133,7 @@ (define-configuration home-zsh-configuration (environment-variables (alist '()) "Association list of environment variables to set for the Zsh session." - serialize-posix-env-vars) + (serializer serialize-posix-env-vars)) (zshenv (text-config '()) "List of file-like objects, which will be added to @file{.zshenv}. @@ -334,7 +334,7 @@ (define-configuration home-bash-configuration rules for the @code{home-environment-variables-service-type} apply here (@pxref{Essential Home Services}). The contents of this field will be added after the contents of the @code{bash-profile} field." - serialize-posix-env-vars) + (serializer serialize-posix-env-vars)) (aliases (alist '()) "Association list of aliases to set for the Bash session. The aliases will be @@ -351,7 +351,7 @@ (define-configuration home-bash-configuration @example alias ls=\"ls -alF\" @end example" - bash-serialize-aliases) + (serializer bash-serialize-aliases)) (bash-profile (text-config '()) "List of file-like objects, which will be added to @file{.bash_profile}. @@ -536,19 +536,19 @@ (define-configuration home-fish-configuration (environment-variables (alist '()) "Association list of environment variables to set in Fish." - serialize-fish-env-vars) + (serializer serialize-fish-env-vars)) (aliases (alist '()) "Association list of aliases for Fish, both the key and the value should be a string. An alias is just a simple function that wraps a command, If you want something more akin to @dfn{aliases} in POSIX shells, see the @code{abbreviations} field." - serialize-fish-aliases) + (serializer serialize-fish-aliases)) (abbreviations (alist '()) "Association list of abbreviations for Fish. These are words that, when typed in the shell, will automatically expand to the full text." - serialize-fish-abbreviations)) + (serializer serialize-fish-abbreviations))) (define (fish-files-service config) `(("fish/config.fish" diff --git a/gnu/services/audio.scm b/gnu/services/audio.scm index 4885fb8424..c073b85a32 100644 --- a/gnu/services/audio.scm +++ b/gnu/services/audio.scm @@ -370,7 +370,7 @@ (define-configuration mpd-configuration (music-dir ; TODO: deprecated, remove later maybe-string "The directory to scan for music files." - mpd-serialize-deprecated-field) + (serializer mpd-serialize-deprecated-field)) (playlist-directory maybe-string @@ -379,7 +379,7 @@ (define-configuration mpd-configuration (playlist-dir ; TODO: deprecated, remove later maybe-string "The directory to store playlists." - mpd-serialize-deprecated-field) + (serializer mpd-serialize-deprecated-field)) (db-file maybe-string @@ -405,16 +405,17 @@ (define-configuration mpd-configuration port is used. To use a Unix domain socket, an absolute path or a path starting with @code{~} can be specified here." - (lambda (_ endpoints) - (if (maybe-value-set? endpoints) - (mpd-serialize-list-of-strings "bind_to_address" endpoints) - ""))) + (serializer + (lambda (_ endpoints) + (if (maybe-value-set? endpoints) + (mpd-serialize-list-of-strings "bind_to_address" endpoints) + "")))) (address ; TODO: deprecated, remove later maybe-string "The address that mpd will bind to. To use a Unix domain socket, an absolute path can be specified here." - mpd-serialize-deprecated-field) + (serializer mpd-serialize-deprecated-field)) (database maybe-mpd-plugin @@ -431,29 +432,29 @@ (define-configuration mpd-configuration (inputs (list-of-mpd-plugin '()) "List of MPD input plugin configurations." - (lambda (_ x) - (mpd-serialize-list-of-mpd-plugin "input" x))) + (serializer (lambda (_ x) + (mpd-serialize-list-of-mpd-plugin "input" x)))) (archive-plugins (list-of-mpd-plugin '()) "List of MPD archive plugin configurations." - (lambda (_ x) - (mpd-serialize-list-of-mpd-plugin "archive_plugin" x))) + (serializer (lambda (_ x) + (mpd-serialize-list-of-mpd-plugin "archive_plugin" x)))) (input-cache-size maybe-string "MPD input cache size." - (lambda (_ x) - (if (maybe-value-set? x) - #~(string-append "\ninput_cache {\n" - #$(mpd-serialize-string "size" x) - "}\n") ""))) + (serializer (lambda (_ x) + (if (maybe-value-set? x) + #~(string-append "\ninput_cache {\n" + #$(mpd-serialize-string "size" x) + "}\n") "")))) (decoders (list-of-mpd-plugin '()) "List of MPD decoder plugin configurations." - (lambda (_ x) - (mpd-serialize-list-of-mpd-plugin "decoder" x))) + (serializer (lambda (_ x) + (mpd-serialize-list-of-mpd-plugin "decoder" x)))) (resampler maybe-mpd-plugin @@ -462,8 +463,8 @@ (define-configuration mpd-configuration (filters (list-of-mpd-plugin '()) "List of MPD filter plugin configurations." - (lambda (_ x) - (mpd-serialize-list-of-mpd-plugin "filter" x))) + (serializer (lambda (_ x) + (mpd-serialize-list-of-mpd-plugin "filter" x)))) (outputs (list-of-mpd-plugin-or-output (list (mpd-output))) @@ -473,8 +474,8 @@ (define-configuration mpd-configuration (playlist-plugins (list-of-mpd-plugin '()) "List of MPD playlist plugin configurations." - (lambda (_ x) - (mpd-serialize-list-of-mpd-plugin "playlist_plugin" x))) + (serializer (lambda (_ x) + (mpd-serialize-list-of-mpd-plugin "playlist_plugin" x)))) (extra-options (alist '()) diff --git a/gnu/services/linux.scm b/gnu/services/linux.scm index d085b375a2..229220eeb1 100644 --- a/gnu/services/linux.scm +++ b/gnu/services/linux.scm @@ -213,9 +213,10 @@ (define-configuration fstrim-configuration maybe-list-of-strings "Extra options to append to @command{fstrim} (run @samp{man fstrim} for more information)." - (lambda (_ value) - (if (maybe-value-set? value) - value '()))) + (serializer + (lambda (_ value) + (if (maybe-value-set? value) + value '())))) (prefix fstrim-)) (define (serialize-fstrim-configuration config) diff --git a/gnu/services/security.scm b/gnu/services/security.scm index 8116072920..e750bb468b 100644 --- a/gnu/services/security.scm +++ b/gnu/services/security.scm @@ -200,7 +200,7 @@ (define-configuration fail2ban-jail-configuration "Backend to use to detect changes in the @code{log-path}. The default is 'auto. To consult the defaults of the jail configuration, refer to the @file{/etc/fail2ban/jail.conf} file of the @code{fail2ban} package." - fail2ban-jail-configuration-serialize-backend) + (serializer fail2ban-jail-configuration-serialize-backend)) (max-retry maybe-integer "The number of failures before a host get banned @@ -269,7 +269,7 @@ (define-configuration fail2ban-jail-configuration maybe-symbol "The encoding of the log files handled by the jail. Possible values are: @code{'ascii}, @code{'utf-8} and @code{'auto}." - fail2ban-jail-configuration-serialize-log-encoding) + (serializer fail2ban-jail-configuration-serialize-log-encoding)) (log-path (list-of-strings '()) "The file names of the log files to be monitored.") @@ -280,7 +280,7 @@ (define-configuration fail2ban-jail-configuration (text-config '()) "Extra content for the jail configuration, provided as a list of file-like objects." - serialize-text-config) + (serializer serialize-text-config)) (prefix fail2ban-jail-configuration-)) (define list-of-fail2ban-jail-configurations? diff --git a/tests/services/configuration.scm b/tests/services/configuration.scm index 0392cce927..8ad5907f37 100644 --- a/tests/services/configuration.scm +++ b/tests/services/configuration.scm @@ -82,6 +82,9 @@ (define (custom-number-serializer name value) (format #f "~a = ~a;" name value)) (define-configuration serializable-configuration + (port (number 80) "The port number." (serializer custom-number-serializer))) + +(define-configuration serializable-configuration-deprecated (port (number 80) "The port number." custom-number-serializer)) (test-assert "serialize-configuration" @@ -89,8 +92,14 @@ (define-configuration serializable-configuration (let ((config (serializable-configuration))) (serialize-configuration config serializable-configuration-fields)))) +(test-assert "serialize-configuration [deprecated]" + (gexp? + (let ((config (serializable-configuration-deprecated))) + (serialize-configuration + config serializable-configuration-deprecated-fields)))) + (define-configuration serializable-configuration - (port (number 80) "The port number." custom-number-serializer) + (port (number 80) "The port number." (serializer custom-number-serializer)) (no-serialization)) (test-assert "serialize-configuration with no-serialization" -- 2.39.1 From unknown Fri Jun 20 07:19:24 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: Bruno Victal Subject: bug#62298: closed (Re: [PATCH v4 1/5] services: configuration: Add user-defined sanitizer support.) Message-ID: References: <7c60556d021507973524cdbadc496571a678b826.camel@gmail.com> X-Gnu-PR-Message: they-closed 62298 X-Gnu-PR-Package: guix-patches X-Gnu-PR-Keywords: patch Reply-To: 62298@debbugs.gnu.org Date: Sun, 02 Apr 2023 10:47:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1680432422-7027-1" This is a multi-part message in MIME format... ------------=_1680432422-7027-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #62298: [PATCH 0/8] Extensible define-configuration & mpd/mympd service fix= es 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 62298@debbugs.gnu.org. --=20 62298: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D62298 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1680432422-7027-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 62298-done) by debbugs.gnu.org; 2 Apr 2023 10:46:25 +0000 Received: from localhost ([127.0.0.1]:39257 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pivE9-0001oN-AE for submit@debbugs.gnu.org; Sun, 02 Apr 2023 06:46:25 -0400 Received: from mail-ed1-f66.google.com ([209.85.208.66]:37637) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pivE5-0001o7-7g for 62298-done@debbugs.gnu.org; Sun, 02 Apr 2023 06:46:23 -0400 Received: by mail-ed1-f66.google.com with SMTP id cn12so106594535edb.4 for <62298-done@debbugs.gnu.org>; Sun, 02 Apr 2023 03:46:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1680432375; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:from:to:cc:subject :date:message-id:reply-to; bh=yFiCgjww0ZiU5WpVUveQLnmMOjZN+YQGuB/yWutNf3A=; b=fMtRrtwGcIxt2RcgfwbyTqMLLRrIyevyoCIG3hheTV64Ubb0nFMeeOZipKdzrRDRcm aixD7QDG+8qgCXSQOyr2QXDdXmm4uuASzSinJ2C6LmxS7KIZ2NwxlfaMOR66QUkdX1bw V0/6vtTkOlDO9iz3ZA14uVloYpUb93kgI/w74MCL5q0i77jR1/n2uIpeVNKQIS5/fIx3 1ZHnJEONfWdSjdWABDV4KhS5K1TJOmKK4CoDfbgwqrJY7+ID+I7+8u2z8vhHA8xw32bt 8S0Yp2mmzZYDadgCLvhJBePSBSHTtVnoU+qmxeVMT/SUkKultGsQ7bWHIAy9t9XHos24 08Qw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680432375; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=yFiCgjww0ZiU5WpVUveQLnmMOjZN+YQGuB/yWutNf3A=; b=aPCNiWKipopx36ffUai0i7L+aIU4uf1AbVOxOQYYFEe8j+0qjObdqTR2ND8nT+xv3N QfdLIu0Ciu9JhpOniVklUE+IgfK3o4IXkxet30avmupJMN7W5wHl0ZysZdLbz6q2F29h m9nAxULzVWT+SyDrvsPLtFjohkglGhDPuIfS2lLdeWQ3pEBAugW0tZXzU9mdOePttnny pPr0Ofy5XPCTqwJpajE2yv5nMiP1EfTxH2/ppqkwwcMYpV8/bXKfc94BFBu60W12hWJX dKONTG5/D48bDutq6/pX9bRjmGZjq5PzWcv7UQ9i16wWXpXaGCzeE33JpJfKBfqbOKnd KeEw== X-Gm-Message-State: AAQBX9eKNX8cLwYYe7a9GKDe0HPKHi/d9qhId/Q5wC7/w9BMDLmWfJOP ofbe5CCphVgs4ijsT5NPGbA= X-Google-Smtp-Source: AKy350YZ9Xy5nwSnAksMRWJRzfhugaPlYBeCrXGIpdoTqL30hnWJMPyVa+Jr5UXOx28/qfzYDEcY6g== X-Received: by 2002:a17:907:8687:b0:93b:46f7:a716 with SMTP id qa7-20020a170907868700b0093b46f7a716mr42015261ejc.50.1680432375284; Sun, 02 Apr 2023 03:46:15 -0700 (PDT) Received: from lumine.fritz.box (85-127-52-93.dsl.dynamic.surfer.at. [85.127.52.93]) by smtp.gmail.com with ESMTPSA id a16-20020a170906275000b0093a35f65a30sm3057332ejd.41.2023.04.02.03.46.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 02 Apr 2023 03:46:14 -0700 (PDT) Message-ID: <7c60556d021507973524cdbadc496571a678b826.camel@gmail.com> Subject: Re: [PATCH v4 1/5] services: configuration: Add user-defined sanitizer support. From: Liliana Marie Prikler To: Bruno Victal , 62298-done@debbugs.gnu.org Date: Sun, 02 Apr 2023 12:46:12 +0200 In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.46.0 MIME-Version: 1.0 X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 62298-done Cc: ludo@gnu.org, maxim.cournoyer@gmail.com 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 (-) Am Sonntag, dem 26.03.2023 um 19:41 +0100 schrieb Bruno Victal: > This changes the 'custom-serializer' field into a generic > 'extra-args' field that can be extended to support new literals. > With this mechanism, the literals 'sanitizer' allow for user-defined > sanitizer procedures while the 'serializer' literal is used for > custom serializer procedures. The 'empty-serializer' was also added > as a 'literal' and can be used just like it was previously. > ... I pushed v4 with changes to the ChangeLog as necessary and the following: - mpd-user and mympd-user belong to %lazy-group. - inject-user-into-group is %set-user-group. - %mpd-user and %mpd-group are properly documented,=C2=A0 but remain unexported. Same for %mympd-user and %mympd-group. Thanks for your hard work and cheers Liliana ------------=_1680432422-7027-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 20 Mar 2023 16:46:18 +0000 Received: from localhost ([127.0.0.1]:55594 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1peIeI-0002M6-20 for submit@debbugs.gnu.org; Mon, 20 Mar 2023 12:46:18 -0400 Received: from lists.gnu.org ([209.51.188.17]:51044) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1peIeG-0002Lw-LL for submit@debbugs.gnu.org; Mon, 20 Mar 2023 12:46:16 -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 1peIeG-0000Zq-DJ for guix-patches@gnu.org; Mon, 20 Mar 2023 12:46:16 -0400 Received: from smtpmciv3.myservices.hosting ([185.26.107.239]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1peIe9-0006xf-KT for guix-patches@gnu.org; Mon, 20 Mar 2023 12:46:16 -0400 Received: from mail1.netim.hosting (unknown [185.26.106.173]) by smtpmciv3.myservices.hosting (Postfix) with ESMTP id BA0CB20407 for ; Mon, 20 Mar 2023 17:45:58 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by mail1.netim.hosting (Postfix) with ESMTP id 682B280098; Mon, 20 Mar 2023 17:45:58 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at mail1.netim.hosting Received: from mail1.netim.hosting ([127.0.0.1]) by localhost (mail1-2.netim.hosting [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id 3PYLzLgXaX8n; Mon, 20 Mar 2023 17:45:56 +0100 (CET) Received: from guix-nuc.home.arpa (bl9-119-177.dsl.telepac.pt [85.242.119.177]) (Authenticated sender: lumen@makinata.eu) by mail1.netim.hosting (Postfix) with ESMTPSA id 37C8280079; Mon, 20 Mar 2023 17:45:56 +0100 (CET) From: Bruno Victal To: guix-patches@gnu.org Subject: [PATCH 0/8] Extensible define-configuration & mpd/mympd service fixes Date: Mon, 20 Mar 2023 16:45:47 +0000 Message-Id: X-Mailer: git-send-email 2.39.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Debbugs-CC: liliana.prikler@gmail.com, maxim.cournoyer@gmail.com, ludo@gnu.org Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=185.26.107.239; envelope-from=mirai@makinata.eu; helo=smtpmciv3.myservices.hosting X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.3 (-) X-Debbugs-Envelope-To: submit Cc: Bruno Victal 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.3 (--) Highlights: * Make define-configuration extensible. define-configuration can now have extra fields where custom-serializer was located. * New literals: sanitizer, serializer. Support user-specified sanitizers. * Fixes . * Switch to user-account/group for mympd-service-type as well. * Make mpd-service-type with pulseaudio usable out-of-the-box. * Fix a mympd-service-type when logging with syslog. Bruno Victal (8): services: configuration: Add user-defined sanitizer support. services: replace bare serializers with (serializer ...) services: audio: remove redundant list-of-string? predicate. services: mympd: Require 'syslog service when configured to log to syslog. services: mpd: Fix unintentional API breakage for mixer-type field. services: mpd: Set PulseAudio related variables as default value for environment-variables field. services: mpd: Use user-account (resp. user-group) for user (resp. group) fields. services: mympd: Use user-account (resp. user-group) for user (resp. group) fields. doc/guix.texi | 46 +++++-- gnu/home/services/shells.scm | 12 +- gnu/services/audio.scm | 224 ++++++++++++++++++++++--------- gnu/services/configuration.scm | 97 ++++++++++--- gnu/services/security.scm | 6 +- tests/services/configuration.scm | 156 ++++++++++++++++++++- 6 files changed, 431 insertions(+), 110 deletions(-) -- 2.39.1 ------------=_1680432422-7027-1--