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.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 45836 in the body.
You can then email your comments to 45836 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-guix <at> gnu.org:
bug#45836; Package guix. (Wed, 13 Jan 2021 01:10:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Leo Prikler <leo.prikler <at> student.tugraz.at>:
New bug report received and forwarded. Copy sent to bug-guix <at> gnu.org. (Wed, 13 Jan 2021 01:10:01 GMT) Full text and rfc822 format available.

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

From: Leo Prikler <leo.prikler <at> student.tugraz.at>
To: bug-guix <at> gnu.org
Subject: cups-service-type duplicates lp group
Date: Wed, 13 Jan 2021 02:09:23 +0100
Hello Guix,

it has come to my attention due to the recent reporting of #45830 and
some conversation in IRC, that cups-service-type adds an lp group,
which is already defined in %base-groups.  Since both share the same
definition, this is not too big an issue, but it prohibits us from
using a hard error for #45770.

I can currently think of two solutions: Either remove the lp group from
cups-service-type or remove it from base-groups.  Neither sounds
particularly awesome.  Perhaps we could also delete identical
duplicates before asserting that there are none for #45770, but that
sounds like a little much effort.  Any ideas how else to solve this?

Regards,
Leo





Information forwarded to bug-guix <at> gnu.org:
bug#45836; Package guix. (Wed, 13 Jan 2021 11:29:01 GMT) Full text and rfc822 format available.

Message #8 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: bug#45836: cups-service-type duplicates lp group
Date: Wed, 13 Jan 2021 12:28:34 +0100
Hi Leo,

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

> it has come to my attention due to the recent reporting of #45830 and
> some conversation in IRC, that cups-service-type adds an lp group,
> which is already defined in %base-groups.  Since both share the same
> definition, this is not too big an issue, but it prohibits us from
> using a hard error for #45770.
>
> I can currently think of two solutions: Either remove the lp group from
> cups-service-type or remove it from base-groups.  Neither sounds
> particularly awesome.  Perhaps we could also delete identical
> duplicates before asserting that there are none for #45770, but that
> sounds like a little much effort.  Any ideas how else to solve this?

I’d be pragmatic here:

  1. Ignore duplicates that are identical (don’t report them).

  2. Remove “lp” from %base-groups since it has no use without CUPS
     (right?).

Thanks,
Ludo’.




Information forwarded to bug-guix <at> gnu.org:
bug#45836; Package guix. (Wed, 13 Jan 2021 12:08:01 GMT) Full text and rfc822 format available.

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

From: Leo Prikler <leo.prikler <at> student.tugraz.at>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: 45836 <at> debbugs.gnu.org
Subject: Re: bug#45836: cups-service-type duplicates lp group
Date: Wed, 13 Jan 2021 13:06:56 +0100
Hi Ludo,

Am Mittwoch, den 13.01.2021, 12:28 +0100 schrieb Ludovic Courtès:
> Hi Leo,
> 
> Leo Prikler <leo.prikler <at> student.tugraz.at> skribis:
> 
> > it has come to my attention due to the recent reporting of #45830
> > and
> > some conversation in IRC, that cups-service-type adds an lp group,
> > which is already defined in %base-groups.  Since both share the
> > same
> > definition, this is not too big an issue, but it prohibits us from
> > using a hard error for #45770.
> > 
> > I can currently think of two solutions: Either remove the lp group
> > from
> > cups-service-type or remove it from base-groups.  Neither sounds
> > particularly awesome.  Perhaps we could also delete identical
> > duplicates before asserting that there are none for #45770, but
> > that
> > sounds like a little much effort.  Any ideas how else to solve
> > this?
> 
> I’d be pragmatic here:
> 
>   1. Ignore duplicates that are identical (don’t report them).
Is that still not a problem, because either definition could change?

>   2. Remove “lp” from %base-groups since it has no use without CUPS
>      (right?).
That's probably true, but I fear, that some have already added "lp" to
their config.scm.  Would that cause issues?  We could also add CUPS to
%base-services or %desktop-services in some way, but that would
probably cause issues with configurations, that already have it.

Regards,
Leo





Information forwarded to bug-guix <at> gnu.org:
bug#45836; Package guix. (Thu, 14 Jan 2021 11:39:02 GMT) Full text and rfc822 format available.

Message #14 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: bug#45836: cups-service-type duplicates lp group
Date: Thu, 14 Jan 2021 12:38:19 +0100
Hi Leo,

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

>> I’d be pragmatic here:
>> 
>>   1. Ignore duplicates that are identical (don’t report them).
> Is that still not a problem, because either definition could change?

Sure, but that’s a separate issue, which is what #2 addresses.

>>   2. Remove “lp” from %base-groups since it has no use without CUPS
>>      (right?).
> That's probably true, but I fear, that some have already added "lp" to
> their config.scm.  Would that cause issues?

Presumably everyone uses ‘%base-groups’ and thus everyone already has a
definition of “lp”, coming from Guix itself.

On second thought, my proposal was not so good because as the comment in
(gnu system shadow) suggests, there are default udev rules that refer to
the “lp” group.  So it has to exist (to be on the safe side at least).

So perhaps we can leave things unchanged and simply add a comment in
(gnu services cups) that the “lp” group definition is redundant but kept
here for clarity.

WDYT?

If the two “lp” eventually come to differ, we’ll notice via system
tests… and bug reports.

> We could also add CUPS to
> %base-services or %desktop-services in some way, but that would
> probably cause issues with configurations, that already have it.

Adding CUPS by default is not a reasonable option, no.  :-)

Thanks,
Ludo’.




Information forwarded to bug-guix <at> gnu.org:
bug#45836; Package guix. (Thu, 14 Jan 2021 13:08:02 GMT) Full text and rfc822 format available.

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

From: Leo Prikler <leo.prikler <at> student.tugraz.at>
To: 45836 <at> debbugs.gnu.org
Cc: ludo <at> gnu.org
Subject: [PATCH] services: Let cups-service-type reuse base lp group.
Date: Thu, 14 Jan 2021 14:06:11 +0100
* 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.
---
 gnu/services/cups.scm | 10 ++++++++--
 gnu/system/shadow.scm |  4 ++--
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/gnu/services/cups.scm b/gnu/services/cups.scm
index f10615e59e..17ed04e58b 100644
--- a/gnu/services/cups.scm
+++ b/gnu/services/cups.scm
@@ -32,7 +32,7 @@
   #:use-module (guix records)
   #:use-module (guix gexp)
   #:use-module (ice-9 match)
-  #:use-module ((srfi srfi-1) #:select (append-map))
+  #:use-module ((srfi srfi-1) #:select (append-map find))
   #:export (cups-service-type
             cups-configuration
             opaque-cups-configuration
@@ -50,7 +50,13 @@
 ;;; Code:
 
 (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")
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?))
 
   (define group-specs
     (map user-group->gexp groups))
-- 
2.30.0





Information forwarded to bug-guix <at> gnu.org:
bug#45836; Package guix. (Sat, 16 Jan 2021 18:38:01 GMT) Full text and rfc822 format available.

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’.




Information forwarded to bug-guix <at> gnu.org:
bug#45836; Package guix. (Sat, 16 Jan 2021 19:50:01 GMT) Full text and rfc822 format available.

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

From: Leo Prikler <leo.prikler <at> student.tugraz.at>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: 45836 <at> debbugs.gnu.org
Subject: Re: [PATCH] services: Let cups-service-type reuse base lp group.
Date: Sat, 16 Jan 2021 20:49:10 +0100
Hi,
Am Samstag, den 16.01.2021, 19:37 +0100 schrieb Ludovic Courtès:
> 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.
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





Information forwarded to bug-guix <at> gnu.org:
bug#45836; Package guix. (Mon, 18 Jan 2021 14:48:02 GMT) Full text and rfc822 format available.

Message #26 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: Mon, 18 Jan 2021 15:47:20 +0100
Hi,

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

>> > 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.

Ah I see, makes sense to me!

Thanks,
Ludo’.




Reply sent to Leo Prikler <leo.prikler <at> student.tugraz.at>:
You have taken responsibility. (Wed, 20 Jan 2021 08:17:01 GMT) Full text and rfc822 format available.

Notification sent to Leo Prikler <leo.prikler <at> student.tugraz.at>:
bug acknowledged by developer. (Wed, 20 Jan 2021 08:17:02 GMT) Full text and rfc822 format available.

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

From: Leo Prikler <leo.prikler <at> student.tugraz.at>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: 45836-done <at> debbugs.gnu.org
Subject: Re: [PATCH] services: Let cups-service-type reuse base lp group.
Date: Wed, 20 Jan 2021 09:16:13 +0100
Am Montag, den 18.01.2021, 15:47 +0100 schrieb Ludovic Courtès:
> Hi,
> 
> Leo Prikler <leo.prikler <at> student.tugraz.at> skribis:
> 
> > > > 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.
> 
> Ah I see, makes sense to me!
I've now pushed it with eq?, if there's a (good!) reason to change that
to equal?, it can still be done later.

Regards,
Leo





bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 17 Feb 2021 12:24:08 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years and 62 days ago.

Previous Next


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