From debbugs-submit-bounces@debbugs.gnu.org Sat Jan 16 14:49:27 2021 Received: (at 45836) by debbugs.gnu.org; 16 Jan 2021 19:49:27 +0000 Received: from localhost ([127.0.0.1]:44071 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l0rZb-0006UH-Ok for submit@debbugs.gnu.org; Sat, 16 Jan 2021 14:49:27 -0500 Received: from mailrelay.tugraz.at ([129.27.2.202]:60526) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l0rZW-0006U3-A4 for 45836@debbugs.gnu.org; Sat, 16 Jan 2021 14:49:22 -0500 Received: from nijino.local (217-149-173-242.nat.highway.telekom.at [217.149.173.242]) by mailrelay.tugraz.at (Postfix) with ESMTPSA id 4DJ7sg20TVz1LLyW; Sat, 16 Jan 2021 20:49:10 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 mailrelay.tugraz.at 4DJ7sg20TVz1LLyW DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tugraz.at; s=mailrelay; t=1610826551; bh=NLKutc5ikNHcKbT0dG+A5XcmhHCeA62G96kj6TTT6N8=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=GmZEWbbJ6PaaQ/DB0tQZkSxOytP+HpcgVLkYv/74574SFG6vKzrsMTpradNLjjdgd PuwOhwIyUoJ8s6SbZzuzl9WJVCRzImpi1+GYiIWnCxKWXJEy7ZOsCCqB1DNBX7rJ/t rSWiMGnNvWnbMBSk0l4R5BLd+aV5D5tArAX5W+Pw= Message-ID: <5c790abbd52abae17c6b449b4982380f9ae26806.camel@student.tugraz.at> Subject: Re: [PATCH] services: Let cups-service-type reuse base lp group. From: Leo Prikler To: Ludovic =?ISO-8859-1?Q?Court=E8s?= Date: Sat, 16 Jan 2021 20:49:10 +0100 In-Reply-To: <875z3wzq1k.fsf@gnu.org> References: <20210114130610.31936-1-leo.prikler@student.tugraz.at> <875z3wzq1k.fsf@gnu.org> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.34.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TUG-Backscatter-control: bt4lQm5Tva3SBgCuw0EnZw X-Spam-Scanner: SpamAssassin 3.003001 X-Spam-Score-relay: -1.9 X-Scanned-By: MIMEDefang 2.74 on 129.27.10.116 X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 45836 Cc: 45836@debbugs.gnu.org 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: -3.3 (---) Hi, Am Samstag, den 16.01.2021, 19:37 +0100 schrieb Ludovic Courtès: > Hi, > > Leo Prikler skribis: > > > * gnu/services/cups.scm (%cups-accounts): Try to use the lp group > > defined in > > %base-groups. > > * gnu/system/shadow.scm (account-activation): Delete duplicate > > (eq?) users > > and groups before transforming them to specs and asserting, that > > names are > > unique. > > [...] > > > (define %cups-accounts > > - (list (user-group (name "lp") (system? #t)) > > + (list (or > > + ;; The "lp" group should already exist; try to reuse it. > > + (find (lambda (group) > > + (and (user-group? group) > > + (string=? (user-group-name group) "lp"))) > > + %base-groups) > > + (user-group (name "lp") (system? #t))) > > (user-group (name "lpadmin") (system? #t)) > > (user-account > > (name "lp") > > This bit LGTM, and I think it can be committed in a commit of its > own. Will do so once I get my working tree is less dirty. > > diff --git a/gnu/system/shadow.scm b/gnu/system/shadow.scm > > index 0538fb1a24..7c57222716 100644 > > --- a/gnu/system/shadow.scm > > +++ b/gnu/system/shadow.scm > > @@ -321,13 +321,13 @@ of user '~a' is undeclared") > > objects. Raise an error if a user account refers to > > a undefined > > group." > > (define accounts > > - (filter user-account? accounts+groups)) > > + (delete-duplicates (filter user-account? accounts+groups) > > eq?)) > > > > (define user-specs > > (map user-account->gexp accounts)) > > > > (define groups > > - (filter user-group? accounts+groups)) > > + (delete-duplicates (filter user-group? accounts+groups) eq?)) > > Why use ‘eq?’? I’d use ‘equal?’, but note that > records > cannot necessarily be compared with ‘equal?’ because of the thunked > ‘home-directory’ field (‘equal?’ is meaningless for procedures). My personal reasoning (and perhaps a rather strong opinion) is, that it is an error to add duplicate users even if they happen to be equal?. eq? is only provided as a way out for the specific case of services, that need to do so for safety reasons – e.g. cups to not allow overriding of the lp group if it has been removed from the OS groups for whichever reason. Regards, Leo