aboutsummaryrefslogtreecommitdiff
path: root/guix
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2018-02-07 22:31:48 +0100
committerLudovic Courtès <ludo@gnu.org>2018-02-09 11:23:27 +0100
commit8446dc5a360e3a13fecea870f86efdbd893e3905 (patch)
treeebc77863f7f912fdec22a7d7e8432a4443550fe7 /guix
parenta76acfd3f5ea6cced10af5a191d057f29b87f277 (diff)
downloadgnu-guix-8446dc5a360e3a13fecea870f86efdbd893e3905.tar
gnu-guix-8446dc5a360e3a13fecea870f86efdbd893e3905.tar.gz
ssh: Work around 'select' bug in Guile.
Fixes <https://bugs.gnu.org/30365>. * guix/ssh.scm (remote-daemon-channel)[redirect]: Define 'select*' and use it.
Diffstat (limited to 'guix')
-rw-r--r--guix/ssh.scm17
1 files changed, 13 insertions, 4 deletions
diff --git a/guix/ssh.scm b/guix/ssh.scm
index 5e442024bc..9e90216a2d 100644
--- a/guix/ssh.scm
+++ b/guix/ssh.scm
@@ -108,9 +108,18 @@ Throw an error on failure."
(use-modules (ice-9 match) (rnrs io ports)
(rnrs bytevectors))
- (let ((sock (socket AF_UNIX SOCK_STREAM 0))
- (stdin (current-input-port))
- (stdout (current-output-port)))
+ (let ((sock (socket AF_UNIX SOCK_STREAM 0))
+ (stdin (current-input-port))
+ (stdout (current-output-port))
+ (select* (lambda (read write except)
+ ;; This is a workaround for
+ ;; <https://bugs.gnu.org/30365> in Guile < 2.2.4:
+ ;; since 'select' sometimes returns non-empty sets for
+ ;; no good reason, call 'select' a second time with a
+ ;; zero timeout to filter out incorrect replies.
+ (match (select read write except)
+ ((read write except)
+ (select read write except 0))))))
(setvbuf stdout _IONBF)
;; Use buffered ports so that 'get-bytevector-some' returns up to the
@@ -121,7 +130,7 @@ Throw an error on failure."
(connect sock AF_UNIX ,socket-name)
(let loop ()
- (match (select (list stdin sock) '() '())
+ (match (select* (list stdin sock) '() '())
((reads () ())
(when (memq stdin reads)
(match (get-bytevector-some stdin)