unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#57850] Marionette fix + improvement
@ 2022-09-16  7:26 Christopher Baines
  2022-09-16  7:32 ` [bug#57850] [PATCH 1/2] marionette: Make it easier to debug REPL read failures Christopher Baines
  0 siblings, 1 reply; 6+ messages in thread
From: Christopher Baines @ 2022-09-16  7:26 UTC (permalink / raw)
  To: 57850

[-- Attachment #1: Type: text/plain, Size: 342 bytes --]


I think the 2nd patch to avoid the read error helps with the cgit system
test at least.

Christopher Baines (2):
  marionette: Make it easier to debug REPL read failures.
  marionette: Avoid read error when wait-for-file file is empty.

 gnu/build/marionette.scm | 22 ++++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 987 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [bug#57850] [PATCH 1/2] marionette: Make it easier to debug REPL read failures.
  2022-09-16  7:26 [bug#57850] Marionette fix + improvement Christopher Baines
@ 2022-09-16  7:32 ` Christopher Baines
  2022-09-16  7:32   ` [bug#57850] [PATCH 2/2] marionette: Avoid read error when wait-for-file file is empty Christopher Baines
  2022-09-16  8:37   ` [bug#57850] " Mathieu Othacehe
  0 siblings, 2 replies; 6+ messages in thread
From: Christopher Baines @ 2022-09-16  7:32 UTC (permalink / raw)
  To: 57850

Log the remaining contnet written to the REPL, so that there's more to go on
than:

  socket:5:14: Unknown # object: "#<"

* gnu/build/marionette.scm (marionette-eval): Catch exceptions from read and
log the remainder of the content from the REPL.
---
 gnu/build/marionette.scm | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/gnu/build/marionette.scm b/gnu/build/marionette.scm
index 06b699bd7b..fd59a4c72f 100644
--- a/gnu/build/marionette.scm
+++ b/gnu/build/marionette.scm
@@ -178,7 +178,18 @@ (define (marionette-eval exp marionette)
     (($ <marionette> command pid monitor (= force repl))
      (write exp repl)
      (newline repl)
-     (read repl))))
+     (with-exception-handler
+         (lambda (exn)
+           (simple-format
+            (current-error-port)
+            "error reading marionette response: ~A
+  remaining response: ~A\n"
+            exn
+            (get-line repl))
+           (raise-exception exn))
+       (lambda ()
+         (read repl))
+       #:unwind? #t))))
 
 (define* (wait-for-file file marionette
                         #:key (timeout 10) (read 'read))
-- 
2.37.3





^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [bug#57850] [PATCH 2/2] marionette: Avoid read error when wait-for-file file is empty.
  2022-09-16  7:32 ` [bug#57850] [PATCH 1/2] marionette: Make it easier to debug REPL read failures Christopher Baines
@ 2022-09-16  7:32   ` Christopher Baines
  2022-09-16  8:38     ` [bug#57850] Marionette fix + improvement Mathieu Othacehe
  2022-09-16  8:37   ` [bug#57850] " Mathieu Othacehe
  1 sibling, 1 reply; 6+ messages in thread
From: Christopher Baines @ 2022-09-16  7:32 UTC (permalink / raw)
  To: 57850

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





^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [bug#57850] Marionette fix + improvement
  2022-09-16  7:32 ` [bug#57850] [PATCH 1/2] marionette: Make it easier to debug REPL read failures Christopher Baines
  2022-09-16  7:32   ` [bug#57850] [PATCH 2/2] marionette: Avoid read error when wait-for-file file is empty Christopher Baines
@ 2022-09-16  8:37   ` Mathieu Othacehe
  1 sibling, 0 replies; 6+ messages in thread
From: Mathieu Othacehe @ 2022-09-16  8:37 UTC (permalink / raw)
  To: Christopher Baines; +Cc: 57850


Hey Chris,

> Log the remaining contnet written to the REPL, so that there's more to go on
                       ^
                       content

Looks fine!

Mathieu




^ permalink raw reply	[flat|nested] 6+ messages in thread

* [bug#57850] Marionette fix + improvement
  2022-09-16  7:32   ` [bug#57850] [PATCH 2/2] marionette: Avoid read error when wait-for-file file is empty Christopher Baines
@ 2022-09-16  8:38     ` Mathieu Othacehe
  2022-09-16 10:40       ` bug#57850: " Christopher Baines
  0 siblings, 1 reply; 6+ messages in thread
From: Mathieu Othacehe @ 2022-09-16  8:38 UTC (permalink / raw)
  To: Christopher Baines; +Cc: 57850


> Since #<eof> can't be read.

You can maybe add:

Partially-Fixes: <https://issues.guix.gnu.org/57827>

Looks also fine,

Thanks,

Mathieu




^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#57850: Marionette fix + improvement
  2022-09-16  8:38     ` [bug#57850] Marionette fix + improvement Mathieu Othacehe
@ 2022-09-16 10:40       ` Christopher Baines
  0 siblings, 0 replies; 6+ messages in thread
From: Christopher Baines @ 2022-09-16 10:40 UTC (permalink / raw)
  To: Mathieu Othacehe; +Cc: 57850-done

[-- Attachment #1: Type: text/plain, Size: 273 bytes --]


Mathieu Othacehe <othacehe@gnu.org> writes:

>> Since #<eof> can't be read.
>
> You can maybe add:
>
> Partially-Fixes: <https://issues.guix.gnu.org/57827>
>
> Looks also fine,

Great, I've pushed these patches as
eb9a39c1b75a60fe3946496bb2eee8f32dbf09cd.

Thanks,

Chris

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 987 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-09-16 10:42 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-16  7:26 [bug#57850] Marionette fix + improvement Christopher Baines
2022-09-16  7:32 ` [bug#57850] [PATCH 1/2] marionette: Make it easier to debug REPL read failures Christopher Baines
2022-09-16  7:32   ` [bug#57850] [PATCH 2/2] marionette: Avoid read error when wait-for-file file is empty Christopher Baines
2022-09-16  8:38     ` [bug#57850] Marionette fix + improvement Mathieu Othacehe
2022-09-16 10:40       ` bug#57850: " Christopher Baines
2022-09-16  8:37   ` [bug#57850] " Mathieu Othacehe

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).