bug#45570: [PATCH] system: Assert, that user and group names are unique.

2021-01-07 Thread Ludovic Courtès
Hi, Leo Prikler skribis: > Am Mittwoch, den 06.01.2021, 14:32 +0100 schrieb Ludovic Courtès: >> Hi, >> >> Leo Prikler skribis: >> >> > > > +((first . rest) >> > > > + (if (member first rest =) ; (srfi srfi-1) member >> > > > + (cons first (find-duplicates rest =)) >> > > > +

bug#45570: [PATCH] system: Assert, that user and group names are unique.

2021-01-06 Thread Leo Prikler
Hi, Am Mittwoch, den 06.01.2021, 14:32 +0100 schrieb Ludovic Courtès: > Hi, > > Leo Prikler skribis: > > > > > +((first . rest) > > > > + (if (member first rest =) ; (srfi srfi-1) member > > > > + (cons first (find-duplicates rest =)) > > > > + (find-duplicates rest

bug#45570: [PATCH] system: Assert, that user and group names are unique.

2021-01-06 Thread Ludovic Courtès
Hi, Leo Prikler skribis: >> > +((first . rest) >> > + (if (member first rest =) ; (srfi srfi-1) member >> > + (cons first (find-duplicates rest =)) >> > + (find-duplicates rest =) >> >> Note that this is quadratic; it’s fine as long as we don’t have “too >> many”

bug#45570: [PATCH] system: Assert, that user and group names are unique.

2021-01-06 Thread Leo Prikler
Hi, Am Mittwoch, den 06.01.2021, 10:56 +0100 schrieb Ludovic Courtès: > Hi, > > Leo Prikler skribis: > > > *gnu/system/shadow.scm (find-duplicates): New variable. > > (assert-unique-account-names, assert-unique-group-names): New > > variables. > > (account-activation): Use them here. > >

bug#45570: [PATCH] system: Assert, that user and group names are unique.

2021-01-06 Thread Ludovic Courtès
Hi, Leo Prikler skribis: > *gnu/system/shadow.scm (find-duplicates): New variable. > (assert-unique-account-names, assert-unique-group-names): New variables. > (account-activation): Use them here. [...] > +(define (find-duplicates list =) > + (match list > +('() '()) This should be:

bug#45570: [PATCH] system: Assert, that user and group names are unique.

2021-01-01 Thread Leo Prikler
*gnu/system/shadow.scm (find-duplicates): New variable. (assert-unique-account-names, assert-unique-group-names): New variables. (account-activation): Use them here. --- gnu/system/shadow.scm | 35 +++ 1 file changed, 35 insertions(+) diff --git

bug#45570: [PATCH] system: Assert, that user and group names are unique.

2021-01-01 Thread Danny Milosavljevic
Hi Leo, I agree that this is a good idea. Please use (ice-9 match) instead of car and cdr. Something among these lines would be more transparent: (define (find-duplicates list accessor) (match list (() '()) ((head . tail) (if (member head tail accessor) ;

bug#45570: [PATCH] system: Assert, that user and group names are unique.

2021-01-01 Thread Leo Prikler
*gnu/system/shadow.scm (assert-unique-account-names) (assert-unique-group-names): New variables. (account-activation): Use them here. --- gnu/system/shadow.scm | 28 1 file changed, 28 insertions(+) diff --git a/gnu/system/shadow.scm b/gnu/system/shadow.scm index