Skip to content
Snippets Groups Projects
Commit b6952cad authored by Ludovic Courtès's avatar Ludovic Courtès
Browse files

substitute-binary: Try hard to avoid port buffering.

* guix/scripts/substitute-binary.scm (fetch): In the `file' case, open
  with the `b' flag, so that the coding cookie reading thing doesn't
  lead to buffering some of the data (on 2.0.5).
* tests/utils.scm ("filtered-port, file"): Open with `r0b'.  Fixes a
  test failure with Guile 2.0.5 whereby the first byte of FILE would be
  missing from DECOMPRESSED.
parent 3f69e393
No related branches found
No related tags found
No related merge requests found
...@@ -143,9 +143,8 @@ (define* (fetch uri #:key (buffered? #t) (timeout? #t)) ...@@ -143,9 +143,8 @@ (define* (fetch uri #:key (buffered? #t) (timeout? #t))
provide." provide."
(case (uri-scheme uri) (case (uri-scheme uri)
((file) ((file)
(let ((port (open-input-file (uri-path uri)))) (let ((port (open-file (uri-path uri)
(unless buffered? (if buffered? "rb" "r0b"))))
(setvbuf port _IONBF))
(values port (stat:size (stat port))))) (values port (stat:size (stat port)))))
((http) ((http)
;; On Guile 2.0.5, `http-fetch' fetches the whole thing at once. So ;; On Guile 2.0.5, `http-fetch' fetches the whole thing at once. So
......
...@@ -103,7 +103,7 @@ (define-module (test-utils) ...@@ -103,7 +103,7 @@ (define-module (test-utils)
(test-assert "filtered-port, file" (test-assert "filtered-port, file"
(let* ((file (search-path %load-path "guix.scm")) (let* ((file (search-path %load-path "guix.scm"))
(input (open-file file "r0"))) (input (open-file file "r0b")))
(let*-values (((compressed pids1) (let*-values (((compressed pids1)
(filtered-port `(,%gzip "-c" "--fast") input)) (filtered-port `(,%gzip "-c" "--fast") input))
((decompressed pids2) ((decompressed pids2)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment