summary refs log tree commit diff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2022-12-10 18:12:59 +0100
committerLudovic Courtès <ludo@gnu.org>2022-12-10 18:13:39 +0100
commit7866294e32f1e758d06fce4e1b1035eca3a7d772 (patch)
tree0794c02b6da66e8761b57e7edc9b6a970a426653
parent61b7e9687757aff013b99e4ab15669a950c8b222 (diff)
downloadguix-7866294e32f1e758d06fce4e1b1035eca3a7d772.tar.gz
deduplicate: Use 'sendfile' only with file ports. v1.4.0rc2
Fixes a regression introduced in b129026e2e242e9068158ae6e6fcd8d7c5ea092e.

* guix/store/deduplication.scm (dump-file/deduplicate): Use 'sendfile'
only when INPUT' is a file port.
-rw-r--r--guix/store/deduplication.scm5
1 files changed, 4 insertions, 1 deletions
diff --git a/guix/store/deduplication.scm b/guix/store/deduplication.scm
index 9953675319..acb6ffcc4a 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)))