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

Hi,
Am Samstag, den 16.01.2021, 19:37 +0100 schrieb Ludovic Courtès:
> 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.
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")
> >  <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).
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





  reply	other threads:[~2021-01-16 19:50 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
2021-01-16 19:49     ` Leo Prikler [this message]
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=5c790abbd52abae17c6b449b4982380f9ae26806.camel@student.tugraz.at \
    --to=leo.prikler@student.tugraz.at \
    --cc=45836@debbugs.gnu.org \
    --cc=ludo@gnu.org \
    /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.