From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id sDfSGMlETGQzKgEASxT56A (envelope-from ) for ; Sat, 29 Apr 2023 00:12:25 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id GCzlF8lETGSxSwEAG6o9tA (envelope-from ) for ; Sat, 29 Apr 2023 00:12:25 +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 00D2A46AEC for ; Sat, 29 Apr 2023 00:12:25 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1psWJw-0003aQ-3S; Fri, 28 Apr 2023 18:12:04 -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 1psWJu-0003a6-N5 for bug-guix@gnu.org; Fri, 28 Apr 2023 18:12:02 -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 1psWJu-0002Bo-En for bug-guix@gnu.org; Fri, 28 Apr 2023 18:12:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1psWJt-00036W-OR for bug-guix@gnu.org; Fri, 28 Apr 2023 18:12:01 -0400 X-Loop: help-debbugs@gnu.org Subject: bug#63082: [PATCH 09/17] services: mpd: Let Shepherd effect the user/group change. Resent-From: Bruno Victal Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Fri, 28 Apr 2023 22:12:01 +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: Maxim Cournoyer Cc: 63082@debbugs.gnu.org Received: via spool by 63082-submit@debbugs.gnu.org id=B63082.168271989511884 (code B ref 63082); Fri, 28 Apr 2023 22:12:01 +0000 Received: (at 63082) by debbugs.gnu.org; 28 Apr 2023 22:11:35 +0000 Received: from localhost ([127.0.0.1]:34688 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1psWJS-00035b-Va for submit@debbugs.gnu.org; Fri, 28 Apr 2023 18:11:35 -0400 Received: from smtpm1.myservices.hosting ([185.26.105.232]:54678) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1psWJO-00035P-Fg for 63082@debbugs.gnu.org; Fri, 28 Apr 2023 18:11:33 -0400 Received: from mail1.netim.hosting (unknown [185.26.106.173]) by smtpm1.myservices.hosting (Postfix) with ESMTP id 2EF22201C1; Sat, 29 Apr 2023 00:11:28 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by mail1.netim.hosting (Postfix) with ESMTP id C8F8180097; Sat, 29 Apr 2023 00:11:28 +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 oYgEHA7MVRHf; Sat, 29 Apr 2023 00:11:28 +0200 (CEST) Received: from [192.168.1.239] (unknown [10.192.1.83]) (Authenticated sender: lumen@makinata.eu) by mail1.netim.hosting (Postfix) with ESMTPSA id E32F680060; Sat, 29 Apr 2023 00:11:27 +0200 (CEST) Message-ID: Date: Fri, 28 Apr 2023 23:11:27 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.10.1 Content-Language: en-US References: <70d3c80ef59f9519a69218c504e72c4c836a6ab1.1682690696.git.maxim.cournoyer@gmail.com> From: Bruno Victal In-Reply-To: <70d3c80ef59f9519a69218c504e72c4c836a6ab1.1682690696.git.maxim.cournoyer@gmail.com> 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=1682719945; a=rsa-sha256; cv=none; b=qD6fKEh8beEuj0W4R52fmJFTkRDcFIraz60JCRk01tMUJnPeB67YZ4XOk4G3fom3ZMbmuH SPi/WoElpDV8eSOuzR5364dXEsAi+G3u8+ABc7AdltTeACbAww4aQzRzaDHuszmq7W1YVz TcYdKg5oDZpmlFYD1n+WJmS1X0S6NtJwsVS44U85yqzOIP16ZItEsDfVLRjmKzoGy0gh9P qqL9fnwoFjrLnYC2/pgBjDv7HLvDurK/cRU1aMkgWSR8d7CnfwuZs+QKGtN5M5/HaBm833 hlig/+FHVD042ioMIGB4PZkFgqNqcCt6hzFGscur70cCSeQfTodA1no0jOA+og== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=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=1682719945; 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; bh=1GsiOj4CEtv8ahbegS/XfZB1rHEkgd7dK1sMoDHYw9w=; b=TTAby1ex/E4R7VkRsP9+4c+Cc7fCxmJ0NZKOcy+0mSV5EKIq06VycY/MKGlZxZUDgPAZsN mInDZM6/clMU9bu6gsV+hI+zBipxOWgXH/N3t8kpvKr5BjKKkITAn938JMLGtWVRh8zRuo xeJ7N+G8gbIchVIjRixKZ1v/7RyeGjhoRk7xokgJ14WDKwmJkx+aE5VBY+ZL9V66l7ILHa u/QmpPI5Ut31OEnnrtVKYnsdh8Jk3HA957ftqw5+VuU1KLlFK5nFiAP4EaE372ug5e4H5g R6AfOMp+Xv46NR27uYtAtE2D9eqRtPHfBXToq82lZKyJM8yPn9f03QdSHoT2GA== X-Migadu-Scanner: scn1.migadu.com Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=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: -3.20 X-Spam-Score: -3.20 X-Migadu-Queue-Id: 00D2A46AEC X-TUID: TFBw4kzkmmq0 On 2023-04-28 15:27, Maxim Cournoyer wrote: > Relates to . > > Quoting a MPD developer, regarding MPD's feature to switch user itself: > "that's legacy for the dark ages when proper service managers did not exist" > :-). > > * gnu/services/audio.scm (mpd-serialize-user-account) > (mpd-serialize-user-group): Delete procedures. > * gnu/services/audio.scm (mpd-configuration) [user]: Do not serialize. > [group]: Likewise. > (mpd-shepherd-service): Provide the #:user, #:group and #:supplementary-groups > arguments. > (mympd-shepherd-service): Likewise, and remove the '--user' argument. > * doc/guix.texi (Audio Services): Decorate mpd with @command. > --- > doc/guix.texi | 4 ++-- > gnu/services/audio.scm | 31 ++++++++++++++++++++++--------- > 2 files changed, 24 insertions(+), 11 deletions(-) > > diff --git a/doc/guix.texi b/doc/guix.texi > index a71a05bcf3..19320c2185 100644 > --- a/doc/guix.texi > +++ b/doc/guix.texi > @@ -33569,7 +33569,7 @@ Audio Services > The MPD package. > > @item @code{user} (type: user-account) > -The user to run mpd as. > +The user to run @command{mpd} as. > > @item @code{group} (default: @code{#f}) (type: boolean) > Obsolete. Do not use. > @@ -33612,7 +33612,7 @@ Audio Services > The location of the sticker database. > > @item @code{default-port} (default: @code{6600}) (type: maybe-port) > -The default port to run mpd on. > +The default port to run @command{mpd} on. > > @item @code{endpoints} (type: maybe-list-of-strings) > The addresses that mpd will bind to. A port different from > diff --git a/gnu/services/audio.scm b/gnu/services/audio.scm > index cccf5c2693..550ccc542c 100644 > --- a/gnu/services/audio.scm > +++ b/gnu/services/audio.scm > @@ -3,6 +3,7 @@ > ;;; Copyright © 2019 Ricardo Wurmus > ;;; Copyright © 2020 Ludovic Courtès > ;;; Copyright © 2022⁠–⁠2023 Bruno Victal > +;;; Copyright © 2023 Maxim Cournoyer > ;;; > ;;; This file is part of GNU Guix. > ;;; > @@ -164,9 +165,6 @@ (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-maybe string (prefix mpd-)) > (define-maybe list-of-strings (prefix mpd-)) > (define-maybe boolean (prefix mpd-)) > @@ -387,10 +385,14 @@ (define-configuration mpd-configuration > "The MPD package." > empty-serializer) > > + ;; Note: The user and its group are not serialized, otherwise MPD would > + ;; attempt to switch the user/group itself. The task of switching the > + ;; user/group is left to Shepherd instead. > (user > (user-account %mpd-user) > - "The user to run mpd as." > - (sanitizer mpd-user-sanitizer)) > + "The user to run @command{mpd} as." > + (sanitizer mpd-user-sanitizer) > + (serializer empty-serializer)) Simply write empty-serializer after sanitizer instead. > "--cachedir" #$cache-directory) > #:environment-variables (list #$log-level*) > - #:log-file #$(if (string? log-to) log-to #f)))) > + #:log-file #$(if (string? log-to) log-to #f) Generic advice but how about this instead? --8<---------------cut here---------------start------------->8--- #$@(if (string? log-to) `(#:log-file ,log-to) '()) --8<---------------cut here---------------end--------------->8--- It's cleaner to not explicitly set the keyword argument values when they're not used.