guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

01/03: guix gc: '-d' does not attempt to delete non-user-owned roots.


From: guix-commits
Subject: 01/03: guix gc: '-d' does not attempt to delete non-user-owned roots.
Date: Thu, 11 Apr 2019 12:19:53 -0400 (EDT)

civodul pushed a commit to branch master
in repository guix.

commit c1df77e215b6e69dccbe781307836a3b962c5968
Author: Ludovic Courtès <address@hidden>
Date:   Thu Apr 11 16:55:13 2019 +0200

    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(-)

diff --git a/guix/scripts/gc.scm b/guix/scripts/gc.scm
index 00f1eb8..9a57e5f 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)))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]