guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

03/03: tests: Use unbuffered input ports when decompressing from 'guix p


From: Ludovic Courtès
Subject: 03/03: tests: Use unbuffered input ports when decompressing from 'guix publish'.
Date: Wed, 27 Jul 2016 10:46:53 +0000 (UTC)

civodul pushed a commit to branch master
in repository guix.

commit 37402ecb4379d7199dd4b3386488261938edc780
Author: Ludovic Courtès <address@hidden>
Date:   Wed Jul 27 12:43:12 2016 +0200

    tests: Use unbuffered input ports when decompressing from 'guix publish'.
    
    Fixes <http://bugs.gnu.org/24060>.
    Reported by Chris Marusich <address@hidden>.
    
    * tests/publish.scm (http-get-port): Explicitly call
    'open-socket-for-uri' and add calls to 'setvbuf'.
---
 tests/publish.scm |   12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/tests/publish.scm b/tests/publish.scm
index 0ba3348..4dc8075 100644
--- a/tests/publish.scm
+++ b/tests/publish.scm
@@ -58,8 +58,16 @@
     (lambda (response body) body)))
 
 (define (http-get-port uri)
-  (call-with-values (lambda () (http-get uri #:streaming? #t))
-    (lambda (response port) port)))
+  (let ((socket (open-socket-for-uri uri)))
+    ;; Make sure to use an unbuffered port so that we can then peek at the
+    ;; underlying file descriptor via 'call-with-gzip-input-port'.
+    (setvbuf socket _IONBF)
+    (call-with-values
+        (lambda ()
+          (http-get uri #:port socket #:streaming? #t))
+      (lambda (response port)
+        (setvbuf port _IONBF)
+        port))))
 
 (define (publish-uri route)
   (string-append "http://localhost:6789"; route))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]