all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
To: 63082@debbugs.gnu.org
Cc: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Subject: bug#63082: [PATCH 04/17] services: mpd: Obsolete the 'group' field.
Date: Fri, 28 Apr 2023 10:26:57 -0400	[thread overview]
Message-ID: <ccde27227f29f0937f2ef8ca781b2b8aa4215af8.1682690696.git.maxim.cournoyer@gmail.com> (raw)
In-Reply-To: <cover.1682690696.git.maxim.cournoyer@gmail.com>

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
<user-account> 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
<user-account> 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 <user-account> 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))))
-
 \f
 ;;;
 ;;; 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 <mpd-configuration>.
-   (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 <mpd-configuration> 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 <mpd-configuration> (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 <mpd-configuration>
+    (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 <mympd-configuration>.
-   (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 <mympd-configuration> 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 <mympd-configuration> (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 <mympd-configuration>
+    (user)
+    (list user)))
 
 (define (mympd-log-rotation config)
   (match-record config <mympd-configuration> (log-to)
-- 
2.39.2





  parent reply	other threads:[~2023-04-28 16:53 UTC|newest]

Thread overview: 105+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-26  2:58 bug#63082: mpd defaul configuration does not work ('No database' error) Maxim Cournoyer
2023-04-26  3:11 ` Maxim Cournoyer
2023-04-26 18:28   ` Liliana Marie Prikler
2023-04-28 14:26 ` bug#63082: [PATCH 00/17] Improve out-of-the-box experience with mpd-service-type Maxim Cournoyer
2023-04-28 14:26   ` bug#63082: [PATCH 01/17] services: mpd: Add an 'update' action to trigger a database update Maxim Cournoyer
2023-04-28 14:26   ` bug#63082: [PATCH 02/17] services: mpd: Streamline mpd-user-sanitizer and mympd-user-sanitizer Maxim Cournoyer
2023-04-28 14:26   ` bug#63082: [PATCH 03/17] services: mpd: Rename %set-user-group to set-user-group Maxim Cournoyer
2023-04-28 14:26   ` Maxim Cournoyer [this message]
2023-04-28 21:50     ` bug#63082: [PATCH 04/17] services: mpd: Obsolete the 'group' field Bruno Victal
2023-04-29  1:15       ` Maxim Cournoyer
2023-04-29 12:12         ` Bruno Victal
2023-04-29 17:12           ` Maxim Cournoyer
2023-04-29  6:26     ` Liliana Marie Prikler
2023-04-29  6:35       ` Liliana Marie Prikler
2023-04-29 17:09         ` Maxim Cournoyer
2023-04-29 17:16         ` Maxim Cournoyer
2023-04-29 22:07           ` Liliana Marie Prikler
2023-05-01  1:07             ` Maxim Cournoyer
2023-05-01  6:13               ` Liliana Marie Prikler
2023-05-03  1:53                 ` Maxim Cournoyer
2023-04-28 14:26   ` bug#63082: [PATCH 05/17] services: mpd: List log-level in decreasing verbosity order in doc Maxim Cournoyer
2023-04-28 14:26   ` bug#63082: [PATCH 06/17] services: mympd: Fix log file name Maxim Cournoyer
2023-04-28 21:53     ` Bruno Victal
2023-04-29  1:49       ` Maxim Cournoyer
2023-04-29  1:56         ` Bruno Victal
2023-04-28 14:27   ` bug#63082: [PATCH 07/17] services: mpd: Log to syslog by default Maxim Cournoyer
2023-04-28 22:02     ` Bruno Victal
2023-04-29 16:06       ` Maxim Cournoyer
2023-04-28 14:27   ` bug#63082: [PATCH 08/17] services: mpd: Only rotate log when a log file is specified Maxim Cournoyer
2023-04-28 14:27   ` bug#63082: [PATCH 09/17] services: mpd: Let Shepherd effect the user/group change Maxim Cournoyer
2023-04-28 22:11     ` Bruno Victal
2023-04-29 16:52       ` Maxim Cournoyer
2023-04-28 14:27   ` bug#63082: [PATCH 10/17] system: accounts: Export <user-account> Maxim Cournoyer
2023-04-28 14:27   ` bug#63082: [PATCH 11/17] services: mpd: Warn when the MPD user is not in the "audio" group Maxim Cournoyer
2023-04-29  6:29     ` Liliana Marie Prikler
2023-04-29 17:10       ` Maxim Cournoyer
2023-04-28 14:27   ` bug#63082: [PATCH 12/17] services: mpd: Auto-detect mpd-output mixer type by default Maxim Cournoyer
2023-04-28 14:27   ` bug#63082: [PATCH 13/17] services: mpd: Fix indentation Maxim Cournoyer
2023-04-28 14:27   ` bug#63082: [PATCH 14/17] services: mpd: Obsolete 'environment-variables' field Maxim Cournoyer
2023-04-28 22:17     ` Bruno Victal
2023-04-29 17:04       ` Maxim Cournoyer
2023-04-29 17:23         ` Bruno Victal
2023-05-03  1:44           ` Maxim Cournoyer
2023-05-04 16:21             ` Bruno Victal
2023-05-05 14:44               ` Maxim Cournoyer
2023-04-28 14:27   ` bug#63082: [PATCH 15/17] services: mpd: Provision a default cache directory and set HOME Maxim Cournoyer
2023-04-28 22:22     ` Bruno Victal
2023-04-29 17:07       ` Maxim Cournoyer
2023-04-28 14:27   ` bug#63082: [PATCH 16/17] services: mpd: Update basic example Maxim Cournoyer
2023-04-28 14:27   ` bug#63082: [PATCH 17/17] services: Avoid 'delete' overrides warning in audio module Maxim Cournoyer
2023-04-29 17:21 ` bug#63082: [PATCH v2 00/16] Improve out-of-the-box experience with mpd-service-type Maxim Cournoyer
2023-04-29 17:21   ` bug#63082: [PATCH v2 01/16] services: mpd: Add an 'update' action to trigger a database update Maxim Cournoyer
2023-04-29 17:21   ` bug#63082: [PATCH v2 02/16] services: mpd: Streamline mpd-user-sanitizer and mympd-user-sanitizer Maxim Cournoyer
2023-04-29 17:21   ` bug#63082: [PATCH v2 03/16] services: mpd: Rename %set-user-group to set-user-group Maxim Cournoyer
2023-04-29 17:21   ` bug#63082: [PATCH v2 04/16] services: mpd: Obsolete the 'group' field Maxim Cournoyer
2023-05-05  0:38     ` Bruno Victal
2023-05-05 15:09       ` bug#63082: mpd defaul configuration does not work ('No database' error) Maxim Cournoyer
2023-04-29 17:21   ` bug#63082: [PATCH v2 05/16] services: mpd: List log-level in decreasing verbosity order in doc Maxim Cournoyer
2023-04-29 17:21   ` bug#63082: [PATCH v2 06/16] services: mpd; Refactor start slot directory initialization Maxim Cournoyer
2023-04-29 17:21   ` bug#63082: [PATCH v2 07/16] services: mpd: Log to syslog by default Maxim Cournoyer
2023-04-29 17:21   ` bug#63082: [PATCH v2 08/16] services: mpd: Do not rotate logs when using syslog Maxim Cournoyer
2023-04-29 17:21   ` bug#63082: [PATCH v2 09/16] services: mpd: Let Shepherd effect the user/group change Maxim Cournoyer
2023-04-29 17:21   ` bug#63082: [PATCH v2 10/16] system: accounts: Export <user-account> Maxim Cournoyer
2023-04-29 17:21   ` bug#63082: [PATCH v2 11/16] services: mpd: Warn when the MPD user is not in the "audio" group Maxim Cournoyer
2023-04-29 17:21   ` bug#63082: [PATCH v2 12/16] services: mpd: Auto-detect mpd-output mixer type by default Maxim Cournoyer
2023-04-29 17:21   ` bug#63082: [PATCH v2 13/16] services: mpd: Obsolete 'environment-variables' field Maxim Cournoyer
2023-04-29 17:21   ` bug#63082: [PATCH v2 14/16] services: mpd: Provision a default cache directory and set HOME Maxim Cournoyer
2023-04-29 17:21   ` bug#63082: [PATCH v2 15/16] services: mpd: Update basic example Maxim Cournoyer
2023-04-29 17:21   ` bug#63082: [PATCH v2 16/16] services: Avoid 'delete' overrides warning in audio module Maxim Cournoyer
2023-05-05 18:28 ` bug#63082: [PATCH v3 00/16] Improve out-of-the-box experience with mpd-service-type Maxim Cournoyer
2023-05-05 18:28   ` bug#63082: [PATCH v3 01/16] services: mpd: Add auto-update? field to mpd-configuration Maxim Cournoyer
2023-05-05 18:28   ` bug#63082: [PATCH v3 02/16] services: mpd: Add an 'update' action to trigger a database update Maxim Cournoyer
2023-05-24 16:00     ` Bruno Victal
2023-07-25 20:48       ` bug#63082: mpd defaul configuration does not work ('No database' error) Maxim Cournoyer
2023-07-26 14:02         ` Bruno Victal
2023-07-26 16:12           ` Maxim Cournoyer
2023-05-05 18:28   ` bug#63082: [PATCH v3 03/16] services: mpd: Streamline mpd-user-sanitizer and mympd-user-sanitizer Maxim Cournoyer
2023-05-05 18:28   ` bug#63082: [PATCH v3 04/16] services: mpd: Rename %set-user-group to set-user-group Maxim Cournoyer
2023-05-05 19:42     ` Liliana Marie Prikler
2023-05-07  2:37       ` Maxim Cournoyer
2023-05-24 16:09     ` Bruno Victal
2023-05-05 18:29   ` bug#63082: [PATCH v3 05/16] services: mpd: Obsolete the 'group' field Maxim Cournoyer
2023-05-05 19:51     ` Liliana Marie Prikler
2023-05-07  2:55       ` Maxim Cournoyer
2023-05-07  5:35         ` Liliana Marie Prikler
2023-05-07 18:12           ` Maxim Cournoyer
2023-05-07 18:31             ` Liliana Marie Prikler
2023-05-08  1:05               ` Maxim Cournoyer
2023-05-08 17:21                 ` Liliana Marie Prikler
2023-05-05 18:29   ` bug#63082: [PATCH v3 06/16] services: mpd: List log-level in decreasing verbosity order in doc Maxim Cournoyer
2023-05-05 18:29   ` bug#63082: [PATCH v3 07/16] services: mpd; Refactor start slot directory initialization Maxim Cournoyer
2023-05-24 16:26     ` Bruno Victal
2023-07-25 20:07       ` bug#63082: mpd defaul configuration does not work ('No database' error) Maxim Cournoyer
2023-05-05 18:29   ` bug#63082: [PATCH v3 08/16] services: mpd: Log to syslog by default Maxim Cournoyer
2023-05-05 18:29   ` bug#63082: [PATCH v3 09/16] services: mpd: Do not rotate logs when using syslog Maxim Cournoyer
2023-05-05 18:29   ` bug#63082: [PATCH v3 10/16] services: mpd: Let Shepherd effect the user/group change Maxim Cournoyer
2023-05-24 16:41     ` Bruno Victal
2023-07-25 19:39       ` bug#63082: mpd defaul configuration does not work ('No database' error) Maxim Cournoyer
2023-07-26 15:54       ` bug#63082: [PATCH v3 10/16] services: mpd: Let Shepherd effect the user/group change Maxim Cournoyer
2023-05-05 18:29   ` bug#63082: [PATCH v3 11/16] system: accounts: Export <user-account> Maxim Cournoyer
2023-05-05 18:29   ` bug#63082: [PATCH v3 12/16] services: mpd: Warn when the MPD user is not in the "audio" group Maxim Cournoyer
2023-05-05 18:29   ` bug#63082: [PATCH v3 13/16] services: mpd: Auto-detect mpd-output mixer type by default Maxim Cournoyer
2023-05-05 18:29   ` bug#63082: [PATCH v3 14/16] services: mpd: Provision a default cache directory and set HOME Maxim Cournoyer
2023-05-05 18:29   ` bug#63082: [PATCH v3 15/16] services: mpd: Update basic example Maxim Cournoyer
2023-05-05 18:29   ` bug#63082: [PATCH v3 16/16] services: Avoid 'delete' overrides warning in audio module Maxim Cournoyer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ccde27227f29f0937f2ef8ca781b2b8aa4215af8.1682690696.git.maxim.cournoyer@gmail.com \
    --to=maxim.cournoyer@gmail.com \
    --cc=63082@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.