summary refs log tree commit diff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2016-12-31 18:34:17 +0100
committerLudovic Courtès <ludo@gnu.org>2016-12-31 18:35:29 +0100
commit13164a210224025384061a5d4c522fa1983c10b4 (patch)
tree11e3da3879b1411ff9d4ba8eb548618e843943b7
parent23973e4fbf1547da10a4d1e16c293192ee6a05ed (diff)
downloadguix-13164a210224025384061a5d4c522fa1983c10b4.tar.gz
ssh: 'retrieve-files' detects remote export failures.
* guix/ssh.scm (retrieve-files): Call 'lookahead-u8' and raise a
'&message' condition when it returns EOF.
-rw-r--r--guix/ssh.scm13
1 files changed, 13 insertions, 0 deletions
diff --git a/guix/ssh.scm b/guix/ssh.scm
index 226c4fd97d..3548243839 100644
--- a/guix/ssh.scm
+++ b/guix/ssh.scm
@@ -25,7 +25,10 @@
   #:use-module (ssh dist)
   #:use-module (ssh dist node)
   #:use-module (srfi srfi-11)
+  #:use-module (srfi srfi-34)
+  #:use-module (srfi srfi-35)
   #:use-module (ice-9 match)
+  #:use-module (ice-9 binary-ports)
   #:export (connect-to-remote-daemon
             send-files
             retrieve-files
@@ -205,6 +208,16 @@ LOCAL.  When RECURSIVE? is true, retrieve the closure of FILES."
     (format #t (N_ "retrieving ~a store item from '~a'...~%"
                    "retrieving ~a store items from '~a'...~%" count)
             count (remote-store-host remote))
+    (when (eof-object? (lookahead-u8 port))
+      ;; The failure could be because one of the requested store items is not
+      ;; valid on REMOTE, or because Guile or Guix is improperly installed.
+      ;; TODO: Improve error reporting.
+      (raise (condition
+              (&message
+               (message
+                (format #f
+                        (_ "failed to retrieve store items from '~a'")
+                        (remote-store-host remote)))))))
 
     (let ((result (import-paths local port)))
       (close-port port)