all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Ludovic Courtès" <ludo@gnu.org>
To: Leo Prikler <leo.prikler@student.tugraz.at>
Cc: 45836@debbugs.gnu.org
Subject: bug#45836: [PATCH] services: Let cups-service-type reuse base lp group.
Date: Sat, 16 Jan 2021 19:37:27 +0100	[thread overview]
Message-ID: <875z3wzq1k.fsf@gnu.org> (raw)
In-Reply-To: <20210114130610.31936-1-leo.prikler@student.tugraz.at> (Leo Prikler's message of "Thu, 14 Jan 2021 14:06:11 +0100")

Hi,

Leo Prikler <leo.prikler@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’.




  reply	other threads:[~2021-01-16 18:38 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-13  1:09 bug#45836: cups-service-type duplicates lp group Leo Prikler
2021-01-13 11:28 ` Ludovic Courtès
2021-01-13 12:06   ` Leo Prikler
2021-01-14 11:38     ` Ludovic Courtès
2021-01-14 13:06 ` bug#45836: [PATCH] services: Let cups-service-type reuse base " Leo Prikler
2021-01-16 18:37   ` Ludovic Courtès [this message]
2021-01-16 19:49     ` Leo Prikler
2021-01-18 14:47       ` Ludovic Courtès
2021-01-20  8:16         ` Leo Prikler

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=875z3wzq1k.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=45836@debbugs.gnu.org \
    --cc=leo.prikler@student.tugraz.at \
    /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.