projects/guix·commit 7866294e

deduplicate: Use 'sendfile' only with file ports.

7866294e · Ludovic Courtès <[email protected]> · 2022-12-10 18:12:59 +01:00

Fixes a regression introduced in b129026e2e242e9068158ae6e6fcd8d7c5ea092e.

* guix/store/deduplication.scm (dump-file/deduplicate): Use 'sendfile'
only when INPUT' is a file port.
Commit
7866294e32f1e758d06fce4e1b1035eca3a7d772
Parents
61b7e968

Changes

1 files changed · +4 −1

FileStatusAddDelContent
guix/store/deduplication.scmmodified+4−1View file

guix/store/deduplication.scm

View file
diff --git a/guix/store/deduplication.scm b/guix/store/deduplication.scm
index 9953675..acb6ffc 100644
--- a/guix/store/deduplication.scm
+++ b/guix/store/deduplication.scm
@@ -262,7 +262,10 @@ down the road."
(deduplicate file (dump-and-compute-hash) #:store store)
(call-with-output-file file
(lambda (output)
- (sendfile output input size 0)))))
+ (if (file-port? input)
+ (sendfile output input size 0)
+ (dump-port input output size
+ #:buffer-size %deduplication-minimum-size))))))
(define* (copy-file/deduplicate source target
#:key (store (%store-directory)))