aboutsummaryrefslogtreecommitdiff
path: root/guix/store
diff options
context:
space:
mode:
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