GNU bug report logs - #57850
Marionette fix + improvement

Previous Next

Package: guix-patches;

Reported by: Christopher Baines <mail <at> cbaines.net>

Date: Fri, 16 Sep 2022 07:28:02 UTC

Severity: normal

Done: Christopher Baines <mail <at> cbaines.net>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Christopher Baines <mail <at> cbaines.net>
To: 57850 <at> debbugs.gnu.org
Subject: [bug#57850] [PATCH 2/2] marionette: Avoid read error when wait-for-file file is empty.
Date: Fri, 16 Sep 2022 09:32:36 +0200
Since #<eof> can't be read.

* gnu/build/marionette.scm (wait-for-file): Return "" if file is empty.
---
 gnu/build/marionette.scm | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/gnu/build/marionette.scm b/gnu/build/marionette.scm
index fd59a4c72f..5ebf783892 100644
--- a/gnu/build/marionette.scm
+++ b/gnu/build/marionette.scm
@@ -198,7 +198,14 @@ (define* (wait-for-file file marionette
   (match (marionette-eval
           `(let loop ((i ,timeout))
              (cond ((file-exists? ,file)
-                    (cons 'success (call-with-input-file ,file ,read)))
+                    (cons 'success
+                          (let ((content
+                                 (call-with-input-file ,file ,read)))
+                            (if (eof-object? content)
+                                ;; #<eof> can't be read, so convert to the
+                                ;; empty string
+                                ""
+                                content))))
                    ((> i 0)
                     (sleep 1)
                     (loop (- i 1)))
-- 
2.37.3





This bug report was last modified 2 years and 249 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.