guix-commits
[Top][All Lists]
Advanced

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

04/07: deduplication: Leave the store permissions unchanged.


From: guix-commits
Subject: 04/07: deduplication: Leave the store permissions unchanged.
Date: Thu, 25 Jun 2020 06:29:58 -0400 (EDT)

civodul pushed a commit to branch master
in repository guix.

commit 3b7145d821dca246aa6377f56266bc5688806420
Author: Ludovic Courtès <ludo@gnu.org>
AuthorDate: Thu Jun 25 10:18:17 2020 +0200

    deduplication: Leave the store permissions unchanged.
    
    Suggested by Caleb Ristvedt <caleb.ristvedt@cune.org>.
    
    * guix/store/deduplication.scm (call-with-writable-file): Call THUNK
    directly when FILE is (%store-directory).
---
 guix/store/deduplication.scm | 21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)

diff --git a/guix/store/deduplication.scm b/guix/store/deduplication.scm
index 6c0f57d..a742a14 100644
--- a/guix/store/deduplication.scm
+++ b/guix/store/deduplication.scm
@@ -95,17 +95,20 @@ LINK-PREFIX."
             (apply throw args))))))
 
 (define (call-with-writable-file file thunk)
-  (let ((stat (lstat file)))
-    (dynamic-wind
-      (lambda ()
-        (make-file-writable file))
-      thunk
-      (lambda ()
-        (set-file-time file stat)
-        (chmod file (stat:mode stat))))))
+  (if (string=? file (%store-directory))
+      (thunk)                       ;don't meddle with the store's permissions
+      (let ((stat (lstat file)))
+        (dynamic-wind
+          (lambda ()
+            (make-file-writable file))
+          thunk
+          (lambda ()
+            (set-file-time file stat)
+            (chmod file (stat:mode stat)))))))
 
 (define-syntax-rule (with-writable-file file exp ...)
-  "Make FILE writable for the dynamic extent of EXP..."
+  "Make FILE writable for the dynamic extent of EXP..., except if FILE is the
+store."
   (call-with-writable-file file (lambda () exp ...)))
 
 ;; There are 3 main kinds of errors we can get from hardlinking: "Too many



reply via email to

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