summary refs log tree commit diff
path: root/gnu
diff options
context:
space:
mode:
authorJonathan Brielmaier <jonathan.brielmaier@web.de>2021-01-12 22:57:22 +0100
committerJonathan Brielmaier <jonathan.brielmaier@web.de>2021-01-12 23:53:53 +0100
commit8488f45b6e05d646224cc2b410497ddf9864c612 (patch)
treea9b19e345095e375916ed55818bf70d5a1bbdf1c /gnu
parentb1cb9e67a60b094b48c05afa992a602251d3feae (diff)
downloadguix-8488f45b6e05d646224cc2b410497ddf9864c612.tar.gz
Revert "system: Assert, that user and group names are unique."
This reverts commit a3002104a84c60556b6616d100cb98019e48759d, which
breaks certain system configurations like:

$ guix system reconfigure config.scm
guix system: error: the following groups appear more than once: lp
Diffstat (limited to 'gnu')
-rw-r--r--gnu/system/shadow.scm44
1 files changed, 0 insertions, 44 deletions
diff --git a/gnu/system/shadow.scm b/gnu/system/shadow.scm
index 183b2cd387..a69339bc07 100644
--- a/gnu/system/shadow.scm
+++ b/gnu/system/shadow.scm
@@ -20,7 +20,6 @@
 ;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
 
 (define-module (gnu system shadow)
-  #:use-module ((guix diagnostics) #:select (formatted-message))
   #:use-module (guix records)
   #:use-module (guix gexp)
   #:use-module (guix store)
@@ -35,7 +34,6 @@
   #:use-module ((gnu packages admin)
                 #:select (shadow))
   #:use-module (gnu packages bash)
-  #:use-module (ice-9 match)
   #:use-module (srfi srfi-1)
   #:use-module (srfi srfi-26)
   #:use-module (srfi srfi-34)
@@ -224,46 +222,6 @@ for a colorful Guile experience.\\n\\n\"))))\n"))
                          (rename-file ".nanorc" ".config/nano/nanorc"))
                        #t))))
 
-(define (find-duplicates list)
-  "Find duplicate entries in @var{list}.
-Two entries are considered duplicates, if they are @code{equal?} to each other.
-This implementation is made asymptotically faster than @code{delete-duplicates}
-through the internal use of hash tables."
-  (let loop ((list list)
-             ;; We actually modify table in-place, but still allocate it here
-             ;; so that we only need one level of indentation.
-             (table (make-hash-table)))
-    (match list
-      (()
-       (hash-fold (lambda (key value seed)
-                    (if (> value 1)
-                        (cons key seed)
-                        seed))
-                  '()
-                  table))
-      ((first . rest)
-       (hash-set! table first
-                  (1+ (hash-ref table first 0)))
-       (loop rest table)))))
-
-(define (assert-unique-account-names users)
-  (match (find-duplicates (map user-account-name users))
-    (() *unspecified*)
-    (duplicates
-     (raise
-      (formatted-message
-       (G_ "the following accounts appear more than once:~{ ~a~}")
-       duplicates)))))
-
-(define (assert-unique-group-names groups)
-  (match (find-duplicates (map user-group-name groups))
-    (() *unspecified*)
-    (duplicates
-     (raise
-      (formatted-message
-       (G_ "the following groups appear more than once:~{ ~a~}")
-       duplicates)))))
-
 (define (assert-valid-users/groups users groups)
   "Raise an error if USERS refer to groups not listed in GROUPS."
   (let ((groups (list->set (map user-group-name groups))))
@@ -334,8 +292,6 @@ group."
   (define group-specs
     (map user-group->gexp groups))
 
-  (assert-unique-account-names accounts)
-  (assert-unique-group-names groups)
   (assert-valid-users/groups accounts groups)
 
   ;; Add users and user groups.