summary refs log tree commit diff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2013-04-20 10:53:31 +0200
committerLudovic Courtès <ludo@gnu.org>2013-04-20 10:53:31 +0200
commit0ff3e3aa9bea8c82c921db88fc03cb7361b886f7 (patch)
treead619046b6aa9ea9426625105fc778503375d646
parent6858f9d13217b14eeeacede9c42a279468242891 (diff)
downloadguix-0ff3e3aa9bea8c82c921db88fc03cb7361b886f7.tar.gz
daemon: Gracefully handle cases where the daemon does not return a status code.
* guix/store.scm (process-stderr): Check for EOF before doing (read-int p).
-rw-r--r--guix/store.scm5
1 files changed, 4 insertions, 1 deletions
diff --git a/guix/store.scm b/guix/store.scm
index b1b60babf0..b82588b2a0 100644
--- a/guix/store.scm
+++ b/guix/store.scm
@@ -336,7 +336,10 @@ encoding conversion errors."
              #f))
           ((= k %stderr-error)
            (let ((error  (read-latin1-string p))
-                 (status (if (>= (nix-server-minor-version server) 8)
+                 ;; Currently the daemon fails to send a status code for early
+                 ;; errors like DB schema version mismatches, so check for EOF.
+                 (status (if (and (>= (nix-server-minor-version server) 8)
+                                  (not (eof-object? (lookahead-u8 p))))
                              (read-int p)
                              1)))
              (raise (condition (&nix-protocol-error