summaryrefslogtreecommitdiff
path: root/guix/store
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2020-06-25 10:18:17 +0200
committerLudovic Courtès <ludo@gnu.org>2020-06-25 12:29:23 +0200
commit3b7145d821dca246aa6377f56266bc5688806420 (patch)
tree7b52581853e6557ba5cb31a122b20c4b73544662 /guix/store
parent6b654a33324d3b9b122512fce2d4440ea06b46e6 (diff)
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).
Diffstat (limited to 'guix/store')
-rw-r--r--guix/store/deduplication.scm21
1 files changed, 12 insertions, 9 deletions
diff --git a/guix/store/deduplication.scm b/guix/store/deduplication.scm
index 6c0f57dd79..a742a142ee 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