unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / Atom feed
* bug#45836: cups-service-type duplicates lp group
@ 2021-01-13  1:09 Leo Prikler
  2021-01-13 11:28 ` Ludovic Courtès
  2021-01-14 13:06 ` bug#45836: [PATCH] services: Let cups-service-type reuse base " Leo Prikler
  0 siblings, 2 replies; 5+ messages in thread
From: Leo Prikler @ 2021-01-13  1:09 UTC (permalink / raw)
  To: 45836

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





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#45836: cups-service-type duplicates lp group
  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 13:06 ` bug#45836: [PATCH] services: Let cups-service-type reuse base " Leo Prikler
  1 sibling, 1 reply; 5+ messages in thread
From: Ludovic Courtès @ 2021-01-13 11:28 UTC (permalink / raw)
  To: Leo Prikler; +Cc: 45836

Hi Leo,

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




^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#45836: cups-service-type duplicates lp group
  2021-01-13 11:28 ` Ludovic Courtès
@ 2021-01-13 12:06   ` Leo Prikler
  2021-01-14 11:38     ` Ludovic Courtès
  0 siblings, 1 reply; 5+ messages in thread
From: Leo Prikler @ 2021-01-13 12:06 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 45836

Hi Ludo,

Am Mittwoch, den 13.01.2021, 12:28 +0100 schrieb Ludovic Courtès:
> Hi Leo,
> 
> Leo Prikler <leo.prikler@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





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#45836: cups-service-type duplicates lp group
  2021-01-13 12:06   ` Leo Prikler
@ 2021-01-14 11:38     ` Ludovic Courtès
  0 siblings, 0 replies; 5+ messages in thread
From: Ludovic Courtès @ 2021-01-14 11:38 UTC (permalink / raw)
  To: Leo Prikler; +Cc: 45836

Hi Leo,

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




^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#45836: [PATCH] services: Let cups-service-type reuse base lp group.
  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-14 13:06 ` Leo Prikler
  1 sibling, 0 replies; 5+ messages in thread
From: Leo Prikler @ 2021-01-14 13:06 UTC (permalink / raw)
  To: 45836

* 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





^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-01-14 13:26 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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

unofficial mirror of bug-guix@gnu.org 

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://yhetil.org/guix-bugs/0 guix-bugs/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 guix-bugs guix-bugs/ https://yhetil.org/guix-bugs \
		bug-guix@gnu.org
	public-inbox-index guix-bugs

Example config snippet for mirrors.
Newsgroups are available over NNTP:
	nntp://news.yhetil.org/yhetil.gnu.guix.bugs
	nntp://news.gmane.io/gmane.comp.gnu.guix.bugs


AGPL code for this site: git clone http://ou63pmih66umazou.onion/public-inbox.git