From c1df77e215b6e69dccbe781307836a3b962c5968 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Thu, 11 Apr 2019 16:55:13 +0200 Subject: 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. --- guix/scripts/gc.scm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'guix/scripts/gc.scm') 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))) -- cgit v1.2.3