mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-12-24 21:38:07 -05:00
services: etc: Detect and report duplicate entries.
Fixes <https://bugs.gnu.org/40729>. Reported by Christopher Baines <mail@cbaines.net>. * gnu/services.scm (files->etc-directory)[assert-no-duplicates]: New procedure. Use it.
This commit is contained in:
parent
b25ecfa2e0
commit
a322e9d16b
1 changed files with 17 additions and 0 deletions
|
@ -632,6 +632,23 @@ (define (etc-directory service)
|
|||
(files->etc-directory (service-value service)))
|
||||
|
||||
(define (files->etc-directory files)
|
||||
(define (assert-no-duplicates files)
|
||||
(let loop ((files files)
|
||||
(seen (set)))
|
||||
(match files
|
||||
(() #t)
|
||||
(((file _) rest ...)
|
||||
(when (set-contains? seen file)
|
||||
(raise (condition
|
||||
(&message
|
||||
(message (format #f (G_ "duplicate '~a' entry for /etc")
|
||||
file))))))
|
||||
(loop rest (set-insert file seen))))))
|
||||
|
||||
;; Detect duplicates early instead of letting them through, eventually
|
||||
;; leading to a build failure of "etc.drv".
|
||||
(assert-no-duplicates files)
|
||||
|
||||
(file-union "etc" files))
|
||||
|
||||
(define (etc-entry files)
|
||||
|
|
Loading…
Reference in a new issue