[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#63082: [PATCH 11/17] services: mpd: Warn when the MPD user is not in
From: |
Maxim Cournoyer |
Subject: |
bug#63082: [PATCH 11/17] services: mpd: Warn when the MPD user is not in the "audio" group. |
Date: |
Sat, 29 Apr 2023 13:10:47 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) |
Hi Liliana,
Liliana Marie Prikler <liliana.prikler@gmail.com> writes:
> Am Freitag, dem 28.04.2023 um 10:27 -0400 schrieb Maxim Cournoyer:
>> Relates to <https://issues.guix.gnu.org>.
>>
>> * gnu/services/audio.scm (%mpd-user) [group]: Add comment.
>> (mpd-user-sanitizer): Warn if the MPD user is not in the audio group.
>> ---
>> gnu/services/audio.scm | 16 +++++++++++++---
>> 1 file changed, 13 insertions(+), 3 deletions(-)
>>
>> diff --git a/gnu/services/audio.scm b/gnu/services/audio.scm
>> index 550ccc542c..9579432ea3 100644
>> --- a/gnu/services/audio.scm
>> +++ b/gnu/services/audio.scm
>> @@ -30,6 +30,7 @@ (define-module (gnu services audio)
>> #:use-module (gnu services configuration)
>> #:use-module (gnu services shepherd)
>> #:use-module (gnu services admin)
>> + #:use-module (gnu system accounts)
>> #:use-module (gnu system shadow)
>> #:use-module (gnu packages admin)
>> #:use-module (gnu packages mpd)
>> @@ -172,6 +173,8 @@ (define-maybe boolean (prefix mpd-))
>> (define %mpd-user
>> (user-account
>> (name "mpd")
>> + ;; Being in the audio group ensures that PulseAudio can access
>> sound
>> + ;; devices.
>> (group "audio")
>> (system? #t)
>> (comment "Music Player Daemon (MPD) user")
>> @@ -208,10 +211,17 @@ (define (mpd-serialize-port field-name value)
>>
>> (define-maybe port (prefix mpd-))
>>
>> -;;; Procedures for unsupported value types, to be removed.
>> -
>> +;;; Sanitizer procedures.
>> (define (mpd-user-sanitizer value)
>> - (cond ((user-account? value) value)
>> + (cond ((user-account? value)
>> + (match-record value <user-account>
>> + (group supplementary-groups)
>> + (unless (or (string=? "audio" group)
>> + (member "audio" supplementary-groups))
>> + ;; Being in the "audio" group is necessary for access
>> to the
>> + ;; sound devices.
>> + (warning (G_ "mpd user not member of \"audio\"
>> group~%"))))
>> + value)
>> ((string? value)
>> (warning (G_ "string value for 'user' is deprecated, use \
>> user-account instead~%"))
> I think this check is "only" required when using alsa/pulseaudio for
> outputs and should be a hard error then. When configured to write to
> httpd or null outputs, other checks are needed.
I agree, but then the check couldn't be made in a sanitizer and would
need to happen much later (in the start slot to ensure it runs at the
right time?).
I figured the current behavior, while not perfect, is better than the
later.
--
Thanks,
Maxim
- bug#63082: mpd defaul configuration does not work ('No database' error), Maxim Cournoyer, 2023/04/25
- bug#63082: mpd defaul configuration does not work ('No database' error), Maxim Cournoyer, 2023/04/25
- bug#63082: [PATCH 00/17] Improve out-of-the-box experience with mpd-service-type, Maxim Cournoyer, 2023/04/28
- bug#63082: [PATCH 01/17] services: mpd: Add an 'update' action to trigger a database update., Maxim Cournoyer, 2023/04/28
- bug#63082: [PATCH 05/17] services: mpd: List log-level in decreasing verbosity order in doc., Maxim Cournoyer, 2023/04/28
- bug#63082: [PATCH 10/17] system: accounts: Export <user-account>., Maxim Cournoyer, 2023/04/28
- bug#63082: [PATCH 16/17] services: mpd: Update basic example., Maxim Cournoyer, 2023/04/28
- bug#63082: [PATCH 11/17] services: mpd: Warn when the MPD user is not in the "audio" group., Maxim Cournoyer, 2023/04/28
- bug#63082: [PATCH 12/17] services: mpd: Auto-detect mpd-output mixer type by default., Maxim Cournoyer, 2023/04/28
- bug#63082: [PATCH 15/17] services: mpd: Provision a default cache directory and set HOME., Maxim Cournoyer, 2023/04/28
- bug#63082: [PATCH 08/17] services: mpd: Only rotate log when a log file is specified., Maxim Cournoyer, 2023/04/28
- bug#63082: [PATCH 04/17] services: mpd: Obsolete the 'group' field., Maxim Cournoyer, 2023/04/28