From 3b7145d821dca246aa6377f56266bc5688806420 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Thu, 25 Jun 2020 10:18:17 +0200 Subject: deduplication: Leave the store permissions unchanged. Suggested by Caleb Ristvedt . * 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(-) (limited to 'guix/store/deduplication.scm') 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 -- cgit v1.2.3