From: Danny Milosavljevic <dannym@scratchpost.org>
To: Leo Prikler <leo.prikler@student.tugraz.at>
Cc: 45570@debbugs.gnu.org, conjaroy@gmail.com
Subject: bug#45570: [PATCH] system: Assert, that user and group names are unique.
Date: Sat, 2 Jan 2021 02:16:01 +0100 [thread overview]
Message-ID: <20210102021601.74c2205a@scratchpost.org> (raw)
In-Reply-To: <20210101111309.7701-1-leo.prikler@student.tugraz.at>
[-- Attachment #1: Type: text/plain, Size: 822 bytes --]
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) ; (srfi srfi-1) member
(cons head (find-duplicates tail accessor))
(find-duplicates tail accessor)))))
(find-duplicates users
(lambda (a b)
(string=? (user-account-name a)
(user-account-name b)))
(I think one could also use srfi-1 delete-duplicates and then compare the
lengths. Then the entire thing is a one-liner--the only complication is
to find the duplicates again after doing it (for the error message))
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
next prev parent reply other threads:[~2021-01-02 1:17 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-31 18:14 bug#45570: operating-system definitions allow duplicate passwd and group entries Jason Conroy
2021-01-01 11:13 ` bug#45570: [PATCH] system: Assert, that user and group names are unique Leo Prikler
2021-01-02 1:16 ` Danny Milosavljevic [this message]
2021-01-02 5:57 ` Leo Prikler
2021-01-06 9:56 ` Ludovic Courtès
2021-01-06 12:34 ` Leo Prikler
2021-01-06 13:32 ` Ludovic Courtès
2021-01-06 21:00 ` Leo Prikler
2021-01-07 8:29 ` Ludovic Courtès
2021-01-06 21:21 ` bug#45570: [PATCH v2] " Leo Prikler
2021-01-07 8:35 ` Ludovic Courtès
2021-01-07 11:13 ` Leo Prikler
2021-01-07 11:10 ` bug#45570: [PATCH v3] " Leo Prikler
2021-01-11 13:09 ` Ludovic Courtès
2021-01-11 15:06 ` 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
List information: https://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210102021601.74c2205a@scratchpost.org \
--to=dannym@scratchpost.org \
--cc=45570@debbugs.gnu.org \
--cc=conjaroy@gmail.com \
--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 public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).