GNU bug report logs - #45836
cups-service-type duplicates lp group

Previous Next

Package: guix;

Reported by: Leo Prikler <leo.prikler <at> student.tugraz.at>

Date: Wed, 13 Jan 2021 01:10:01 UTC

Severity: normal

Done: Leo Prikler <leo.prikler <at> student.tugraz.at>

Bug is archived. No further changes may be made.

Full log


Message #20 received at 45836 <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Leo Prikler <leo.prikler <at> student.tugraz.at>
Cc: 45836 <at> debbugs.gnu.org
Subject: Re: [PATCH] services: Let cups-service-type reuse base lp group.
Date: Sat, 16 Jan 2021 19:37:27 +0100
Hi,

Leo Prikler <leo.prikler <at> student.tugraz.at> 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.

> 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")
>  <user-group> 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 <user-account> records
cannot necessarily be compared with ‘equal?’ because of the thunked
‘home-directory’ field (‘equal?’ is meaningless for procedures).

Thanks,
Ludo’.




This bug report was last modified 4 years and 176 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.