[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
- branch master updated (b06ba9e -> d1a26be), guix-commits, 2020/06/25
- 01/07: daemon: Correctly handle EMLINK corner case when deduplicating., guix-commits, 2020/06/25
- 02/07: deduplication: Use 'dynamic-wind' when changing permissions of the parent., guix-commits, 2020/06/25
- 03/07: deduplication: Fix default value of #:store in 'deduplicate'., guix-commits, 2020/06/25
- 07/07: gnu: knot-resolver: Enable automatic reloading of policy files., guix-commits, 2020/06/25
- 04/07: deduplication: Leave the store permissions unchanged.,
guix-commits <=
- 05/07: gnu: Add lua-ossl., guix-commits, 2020/06/25
- 06/07: gnu: Add lua-cqueues., guix-commits, 2020/06/25