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).
This commit is contained in:
parent
6b654a3332
commit
3b7145d821
|
@ -95,17 +95,20 @@ LINK-PREFIX."
|
||||||
(apply throw args))))))
|
(apply throw args))))))
|
||||||
|
|
||||||
(define (call-with-writable-file file thunk)
|
(define (call-with-writable-file file thunk)
|
||||||
(let ((stat (lstat file)))
|
(if (string=? file (%store-directory))
|
||||||
(dynamic-wind
|
(thunk) ;don't meddle with the store's permissions
|
||||||
(lambda ()
|
(let ((stat (lstat file)))
|
||||||
(make-file-writable file))
|
(dynamic-wind
|
||||||
thunk
|
(lambda ()
|
||||||
(lambda ()
|
(make-file-writable file))
|
||||||
(set-file-time file stat)
|
thunk
|
||||||
(chmod file (stat:mode stat))))))
|
(lambda ()
|
||||||
|
(set-file-time file stat)
|
||||||
|
(chmod file (stat:mode stat)))))))
|
||||||
|
|
||||||
(define-syntax-rule (with-writable-file file exp ...)
|
(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 ...)))
|
(call-with-writable-file file (lambda () exp ...)))
|
||||||
|
|
||||||
;; There are 3 main kinds of errors we can get from hardlinking: "Too many
|
;; There are 3 main kinds of errors we can get from hardlinking: "Too many
|
||||||
|
|
Loading…
Reference in New Issue