diff options
author | Ludovic Courtès <ludo@gnu.org> | 2019-04-11 16:55:13 +0200 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2019-04-11 18:18:13 +0200 |
commit | c1df77e215b6e69dccbe781307836a3b962c5968 (patch) | |
tree | 7045054e33e28b3525b230974b56dd8ba914a538 /guix | |
parent | c2f6f4e50074ac12fa3bee51d793eeaadce99f55 (diff) |
guix gc: '-d' does not attempt to delete non-user-owned roots.
* guix/scripts/gc.scm (guix-gc)[delete-generations]: Limit to user-owned
roots, unless we're running as root.
Diffstat (limited to 'guix')
-rw-r--r-- | guix/scripts/gc.scm | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/guix/scripts/gc.scm b/guix/scripts/gc.scm index 00f1eb8d00..9a57e5fd1e 100644 --- a/guix/scripts/gc.scm +++ b/guix/scripts/gc.scm @@ -245,7 +245,11 @@ is deprecated; use '-D'~%")) (define (delete-generations store pattern) ;; Delete the generations matching PATTERN of all the user's profiles. (let ((profiles (delete-duplicates - (filter-map generation-profile (gc-roots))))) + (filter-map (lambda (root) + (and (or (zero? (getuid)) + (user-owned? root)) + (generation-profile root))) + (gc-roots))))) (for-each (lambda (profile) (delete-old-generations store profile pattern)) profiles))) |