summary refs log tree commit diff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2018-06-14 23:08:08 +0200
committerLudovic Courtès <ludo@gnu.org>2018-06-14 23:34:59 +0200
commita9a685cc0024a4e0dad5d7abd9ca6fb880ae4f8e (patch)
treef205505f0f18437dc82c1b995c36ca91512947ef
parent565af91acc66404ad7bc9ef3b9f6f5a2ca4460b5 (diff)
downloadguix-a9a685cc0024a4e0dad5d7abd9ca6fb880ae4f8e.tar.gz
offload: Gracefully handle invalid results from 'machines.scm'.
* guix/scripts/offload.scm (build-machines): Check the result of FILE.
Ignore it if it's not a list of <build-machine>.
-rw-r--r--guix/scripts/offload.scm10
1 files changed, 9 insertions, 1 deletions
diff --git a/guix/scripts/offload.scm b/guix/scripts/offload.scm
index fb61d7c059..664497bcd5 100644
--- a/guix/scripts/offload.scm
+++ b/guix/scripts/offload.scm
@@ -124,7 +124,15 @@ determined."
       (save-module-excursion
        (lambda ()
          (set-current-module %user-module)
-         (primitive-load file))))
+         (match (primitive-load file)
+           (((? build-machine? machines) ...)
+            machines)
+           (_
+            ;; Instead of crashing, assume the empty list.
+            (warning (G_ "'~a' did not return a list of build machines; \
+ignoring it~%")
+                     file)
+            '())))))
     (lambda args
       (match args
         (('system-error . rest)