summaryrefslogtreecommitdiff
path: root/guix/store/deduplication.scm
diff options
context:
space:
mode:
authorMarius Bakke <mbakke@fastmail.com>2018-11-14 21:20:46 +0100
committerMarius Bakke <mbakke@fastmail.com>2018-11-14 21:20:46 +0100
commit79ee97a144aaaa890be0724aaf796e2a771179d7 (patch)
treefddd2f20003d60e42eed7a614acea91a13d854d7 /guix/store/deduplication.scm
parent7d9d521fbcf1423f66d6f33208c03d5dacb7ba50 (diff)
parente921993c25626541385f191f0463cad8e5e5c5c7 (diff)
Merge branch 'master' into core-updates
Diffstat (limited to 'guix/store/deduplication.scm')
-rw-r--r--guix/store/deduplication.scm12
1 files changed, 9 insertions, 3 deletions
diff --git a/guix/store/deduplication.scm b/guix/store/deduplication.scm
index 53810c680f..21b0c81f3d 100644
--- a/guix/store/deduplication.scm
+++ b/guix/store/deduplication.scm
@@ -102,11 +102,17 @@ LINK-PREFIX."
SWAP-DIRECTORY as the directory to store temporary hard links.
Note: TARGET, TO-REPLACE, and SWAP-DIRECTORY must be on the same file system."
- (let ((temp-link (get-temp-link target swap-directory)))
- (make-file-writable (dirname to-replace))
+ (let* ((temp-link (get-temp-link target swap-directory))
+ (parent (dirname to-replace))
+ (stat (stat parent)))
+ (make-file-writable parent)
(catch 'system-error
(lambda ()
- (rename-file temp-link to-replace))
+ (rename-file temp-link to-replace)
+
+ ;; Restore PARENT's mtime and permissions.
+ (set-file-time parent stat)
+ (chmod parent (stat:mode stat)))
(lambda args
(delete-file temp-link)
(unless (= EMLINK (system-error-errno args))