summaryrefslogtreecommitdiff
path: root/guix
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2023-03-13 13:52:38 +0100
committerLudovic Courtès <ludo@gnu.org>2023-06-18 23:36:25 +0200
commit1261ce15233cbf7e24de9959df86a23b46314a28 (patch)
tree4745d38afb66475ade2e66fc52a7b9bd3bdb8e3b /guix
parent81231bf236509a50c1b81191989cf6358f497e1b (diff)
store: Tolerate non-existent GC root directories.
* guix/store/roots.scm (gc-roots): Wrap 'scandir*' call in 'catch'. * tests/store-roots.scm ("gc-roots, initial"): New test. Move 'open-connection' call below.
Diffstat (limited to 'guix')
-rw-r--r--guix/store/roots.scm12
1 files changed, 10 insertions, 2 deletions
diff --git a/guix/store/roots.scm b/guix/store/roots.scm
index 222f69c5c0..6b949b5a86 100644
--- a/guix/store/roots.scm
+++ b/guix/store/roots.scm
@@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2012, 2013, 2014, 2017, 2019 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2012-2014, 2017, 2019, 2023 Ludovic Courtès <ludo@gnu.org>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -105,7 +105,15 @@ are user-controlled symlinks stored anywhere on the file system."
(map (match-lambda
((file . properties)
(cons (scope file) properties)))
- (scandir* directory regular?)))))
+ (catch 'system-error
+ (lambda ()
+ (scandir* directory regular?))
+ (lambda args
+ (if (= ENOENT
+ (system-error-errno
+ args))
+ '()
+ (apply throw args))))))))
(loop (append rest (map first sub-directories))
(append (map canonical-root (filter symlink? files))
roots)