From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id wN3eDyf6S2QvSgAASxT56A (envelope-from ) for ; Fri, 28 Apr 2023 18:53:59 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id iOmmDyf6S2TfHwAAauVa8A (envelope-from ) for ; Fri, 28 Apr 2023 18:53:59 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id E87781A95B for ; Fri, 28 Apr 2023 18:53:58 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1psP5C-0007ls-T9; Fri, 28 Apr 2023 10:28:22 -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 1psP4u-0007XB-BL for bug-guix@gnu.org; Fri, 28 Apr 2023 10:28:04 -0400 Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1psP4u-0005yo-20 for bug-guix@gnu.org; Fri, 28 Apr 2023 10:28:04 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1psP4t-00058W-UK for bug-guix@gnu.org; Fri, 28 Apr 2023 10:28:03 -0400 X-Loop: help-debbugs@gnu.org Subject: bug#63082: [PATCH 04/17] services: mpd: Obsolete the 'group' field. Resent-From: Maxim Cournoyer Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Fri, 28 Apr 2023 14:28:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 63082 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: 63082@debbugs.gnu.org Cc: Maxim Cournoyer Received: via spool by 63082-submit@debbugs.gnu.org id=B63082.168269206119604 (code B ref 63082); Fri, 28 Apr 2023 14:28:03 +0000 Received: (at 63082) by debbugs.gnu.org; 28 Apr 2023 14:27:41 +0000 Received: from localhost ([127.0.0.1]:34137 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1psP4W-00055v-Qm for submit@debbugs.gnu.org; Fri, 28 Apr 2023 10:27:41 -0400 Received: from mail-qk1-f179.google.com ([209.85.222.179]:55401) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1psP4M-000548-Lr for 63082@debbugs.gnu.org; Fri, 28 Apr 2023 10:27:31 -0400 Received: by mail-qk1-f179.google.com with SMTP id af79cd13be357-74fc1452fbdso386336085a.2 for <63082@debbugs.gnu.org>; Fri, 28 Apr 2023 07:27:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682692045; x=1685284045; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ftIw5Voni/LtV02KaheyqRtLcnsjgX4ZN/X2LPvGxyY=; b=r32GW2BNxnX5C8lI7+FcvseRPqsFubQaotnCTd4lJSVokLEWggrlJSTPsMMor/FlnU HtLATHTxk8aBxoIAA1BbSrZqRgBgT5pPntSVC5SnY29boBWDbQNbWHBple6jJD741tma S0+y+zHrir/ojoLHE/229UYdz/o85uhqmASwViLK8ra1RQSJD34OT2ghmgOVJj4gXs8e coi25RogbtsX7ZQRrvCx1v18wGRRBhQe3i3GhBs+yUA77QfDeDIGnt1GUJa7y9dFxvZn fG8uiB71NMsUZuLiPblnBRxjS/5onXDt2wNOeHKBJ9MfeIT1m9tBnQBmknhVp5mE91It 7djA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682692045; x=1685284045; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ftIw5Voni/LtV02KaheyqRtLcnsjgX4ZN/X2LPvGxyY=; b=PxPi+eTPBj1xu1u34M4tRWRr+996rYImlT3RLaNjeqnAhIDXgwo4bM8xG1TD93g8mP LWPQ4xlij5U/bVMC6P2GFcwQ54Ak/7ZheYP0PZ6PeibsNArBjrR2bLVtmiUF24I0FiAw k7lyy8qT6yicZmCRH9HYE4kKxNf9ilazrKLaVzqsutHJAaYqb9fl0H+A2IAA476/+S0o X/++lf0nfxk1emvms41p9pj89KmtmcyCdlNNFxyMfGp2fjwABqom57SKP79/7X95Qb6i QGw2T9WnjHIWUtzVP3yHnBkiluX3UpR+dO8P6bK11ido1QAdgRxNIOdmsIjByHtW17I5 HGDg== X-Gm-Message-State: AC+VfDwIQdnfVgWIoNbhPuVeuRuCWY7fG1/fcnASiqWfTMxPybsbN15n RwKr3V9OyK1p2W/2xgOLmoOH3VV0ALw= X-Google-Smtp-Source: ACHHUZ4XC1SAyFPBUxlk+AkrE5DcOBrhtolPK/mUzxm0yfiDrojEPoHC22W7z3+vboinLpDywhs/bA== X-Received: by 2002:a05:6214:2a47:b0:616:5755:ca68 with SMTP id jf7-20020a0562142a4700b006165755ca68mr8934669qvb.25.1682692044960; Fri, 28 Apr 2023 07:27:24 -0700 (PDT) Received: from localhost.localdomain ([2607:fad8:4:3::1000]) by smtp.gmail.com with ESMTPSA id d8-20020a0cfe88000000b005ff569bca72sm6176940qvs.93.2023.04.28.07.27.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Apr 2023 07:27:24 -0700 (PDT) From: Maxim Cournoyer Date: Fri, 28 Apr 2023 10:26:57 -0400 Message-Id: X-Mailer: git-send-email 2.39.2 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-guix@gnu.org List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+larch=yhetil.org@gnu.org Sender: bug-guix-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Seal: i=1; s=key1; d=yhetil.org; t=1682700839; a=rsa-sha256; cv=none; b=XUHVGTNAU6mZ5T7hhEiV38apo6iaKi9QLWnsz0BHTP4qeLlX1bvAGc+48PN2+tXMh/bsOy n9aiE82JmQzM9CTbMIjPymcHrukCFmxvZdhgE0mj051E77CfQFp/KY64KQIIh1vVg/YOyQ UeGjPBTAcrzbgLTugatL9Ir/H8PfNrxSpy2zOlUKDQt1jBAFtUXISQBFmhYL4WH++v6JeO 4KI4kOZhqewxJwJrnL0D8LD/UvatM4xOwI+BPtuZiV9zOIWakWZlIIP/sxzVUln3QLQAFw 6NwmN6PNDXNqEO4rlj4idVqWllXKINeP3jg91SR+jtLYahHywXlS2tjgrgblvQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=gmail.com header.s=20221208 header.b=r32GW2BN; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of "bug-guix-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="bug-guix-bounces+larch=yhetil.org@gnu.org" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1682700839; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=lHNpLCxgiXBlDwB14Hjh7R0bEWq4DaaO9/qJ84m6f+0=; b=VY5gXUJ52tQTgdjKk2s+7pOYr65WFC6QmzWFAqdjheyGycKoR711yplGmxLaj8z4hmzasc fpTsLh96wlP7D7dp/YSxVpx+Tn0+BCH3Ec5T3VRvMHYZO+a/ofm3OCKj2LweuKV33u+hTN Yj4pfIZwO1auadcKDDFadHQk05LzIMKCekvSxZLroodlG7etrE4eACOS5paQGoFZ4TnPPj f3XAQ+XBvwkC9QhA2Z96MD3U1VUUrr/Rg4MZ4Y2oWc6BfDKIJyKuPf/0HE+aJpbKB4ELr3 TyqpI98WNHvOmtMTWCwBlMfVQ2OdOq93ObgqbxlSqqo2ypdxSEbgCi9seUx/Pg== X-Migadu-Scanner: scn1.migadu.com Authentication-Results: aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=gmail.com header.s=20221208 header.b=r32GW2BN; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of "bug-guix-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="bug-guix-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: 5.80 X-Spam-Score: 5.80 X-Migadu-Queue-Id: E87781A95B X-TUID: UjGFQe7qZjDB Prior to this change, there was a discrepancy where a user could have disagreeing groups between the group and user fields (the user field being a record, which includes its primary group as a string). This could have caused problems because the USER's group was being used to set the file permissions, while the GROUP name was serialized to MPD's configuration, and MPD would use it to set the group of its running process. Synchronizing both is not practical, as it can easily lead to slightly different objects conflicting, again causing problems. The compromise is to obsolete the 'group' field. A group can still be configured via the 'user' field, which accepts a object, with the limitation that the group should already exist. * gnu/services/audio.scm (%lazy-group): Delete variable. (%set-user-group): Delete procedure. (mpd-serialize-user-group): Likewise. (%mpd-user) [group]: Default to "audio". (%mpd-group): Delete variable. (mpd-group-sanitizer, mympd-group-sanitizer): Adjust sanitizers. (mpd-configuration, mympd-configuration) [group]: Default to #f. Update doc. (mpd-accounts, mympd-accounts): Remove group. (%mympd-user) [group]: Default to "nogroup". * doc/guix.texi: Regenerate doc. --- doc/guix.texi | 15 ++++---- gnu/services/audio.scm | 80 ++++++++++++------------------------------ 2 files changed, 28 insertions(+), 67 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index f8acdbd6b5..34703b1698 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -33571,8 +33571,8 @@ Audio Services @item @code{user} (type: user-account) The user to run mpd as. -@item @code{group} (type: user-group) -The group to run mpd as. +@item @code{group} (default: @code{#f}) (type: boolean) +Obsolete. Do not use. @item @code{shepherd-requirement} (default: @code{()}) (type: list-of-symbol) This is a list of symbols naming Shepherd services that this service @@ -33824,15 +33824,12 @@ Audio Services This is a list of symbols naming Shepherd services that this service will depend on. -@item @code{user} (default: @code{%mympd-user}) (type: user-account) +@item @code{user} (type: user-account) Owner of the @command{mympd} process. -The default @code{%mympd-user} is a system user with the name ``mympd'', -who is a part of the group @var{group} (see below). -@item @code{group} (default: @code{%mympd-group}) (type: user-group) -Owner group of the @command{mympd} process. +@item @code{group} (default: @code{#f}) (type: boolean) +Obsolete. Do not use. -The default @code{%mympd-group} is a system group with name ``mympd''. @item @code{work-directory} (default: @code{"/var/lib/mympd"}) (type: string) Where myMPD will store its data. @@ -33872,7 +33869,7 @@ Audio Services Override URI to myMPD. See @uref{https://github.com/jcorporation/myMPD/issues/950}. -@item @code{script-acl} (default: @code{(mympd-ip-acl (allow '("127.0.0.1")))}) (type: maybe-mympd-ip-acl) +@item @code{script-acl} (type: maybe-mympd-ip-acl) ACL to access the myMPD script backend. @item @code{ssl?} (default: @code{#f}) (type: boolean) diff --git a/gnu/services/audio.scm b/gnu/services/audio.scm index 7874539810..58262f7842 100644 --- a/gnu/services/audio.scm +++ b/gnu/services/audio.scm @@ -140,14 +140,6 @@ (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 (set-user-group user group) - (user-account - (inherit user) - (group (user-group-name group)))) - ;;; ;;; MPD @@ -175,9 +167,6 @@ (define (mpd-serialize-list-of-strings 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-)) @@ -185,20 +174,13 @@ (define-maybe boolean (prefix mpd-)) (define %mpd-user (user-account (name "mpd") - ;; XXX: This is a place-holder to be lazily substituted in (…-accounts) - ;; with the value from the 'group' field of . - (group %lazy-group) + (group "audio") (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) @@ -242,15 +224,9 @@ (define (mpd-user-sanitizer value) (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)))) + (when value + (warning (G_ "'group' in is obsolete; ignoring~%"))) + #f) ;;; @@ -407,9 +383,10 @@ (define-configuration mpd-configuration (sanitizer mpd-user-sanitizer)) (group - (user-group %mpd-group) - "The group to run mpd as." - (sanitizer mpd-group-sanitizer)) + (boolean #f) + "Obsolete. Do not use." + (sanitizer mpd-group-sanitizer) + (serializer empty-serializer)) (shepherd-requirement (list-of-symbol '()) @@ -633,12 +610,9 @@ (define (mpd-shepherd-service config) (format #t "Service MPD is not running."))))))))))) (define (mpd-accounts config) - (match-record config (user group) - ;; TODO: Deprecation code, to be removed. - (let ((user (if (eq? (user-account-group user) %lazy-group) - (set-user-group user group) - user))) - (list user group)))) + (match-record config + (user) + (list user))) (define mpd-service-type (service-type @@ -676,9 +650,7 @@ (define-maybe/no-serialization mympd-ip-acl) (define %mympd-user (user-account (name "mympd") - ;; XXX: This is a place-holder to be lazily substituted in 'mympd-accounts' - ;; with the value from the 'group' field of . - (group %lazy-group) + (group "nogroup") (system? #t) (comment "myMPD user") (home-directory "/var/empty") @@ -702,15 +674,10 @@ (define (mympd-user-sanitizer value) (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)))) + (when value + (warning (G_ "'group' in is obsolete; ignoring~%"))) + #f) + ;;; @@ -737,10 +704,10 @@ (define-configuration/no-serialization mympd-configuration empty-serializer) (group - (user-group %mympd-group) - "Owner group of the @command{mympd} process." + (boolean #f) + "Obsolete. Do not use." (sanitizer mympd-group-sanitizer) - empty-serializer) + (serializer empty-serializer)) (work-directory (string "/var/lib/mympd") @@ -904,12 +871,9 @@ (define (mympd-shepherd-service config) (stop #~(make-kill-destructor)))))) (define (mympd-accounts config) - (match-record config (user group) - ;; TODO: Deprecation code, to be removed. - (let ((user (if (eq? (user-account-group user) %lazy-group) - (set-user-group user group) - user))) - (list user group)))) + (match-record config + (user) + (list user))) (define (mympd-log-rotation config) (match-record config (log-to) -- 2.39.2