Marionette fix + improvement

  • Done
  • quality assurance status badge
Details
2 participants
  • Christopher Baines
  • Mathieu Othacehe
Owner
unassigned
Submitted by
Christopher Baines
Severity
normal
C
C
Christopher Baines wrote on 16 Sep 2022 09:26
(address . guix-patches@gnu.org)
87h717kccw.fsf@cbaines.net
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(-)
-----BEGIN PGP SIGNATURE-----

iQKlBAEBCgCPFiEEPonu50WOcg2XVOCyXiijOwuE9XcFAmMkJW9fFIAAAAAALgAo
aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldDNF
ODlFRUU3NDU4RTcyMEQ5NzU0RTBCMjVFMjhBMzNCMEI4NEY1NzcRHG1haWxAY2Jh
aW5lcy5uZXQACgkQXiijOwuE9XcfYA/+MRgrkwWpEiPhLmThpPcS4rQJA2sf8y+0
lpyfZDx6jUW7yp5XOrd/oiQzbmlh6TzpSXiV4gV0AB7OfLNDTucxF/YtOsrTLlDh
Hn1A7a/i99siNEwSUSQirDY2+cXnHOrSnc8yhgryVPJaBy7hXEooQ1SDMA7Nr+vm
WoNORKMyR/AiN8XsOnbDHtnO7rsd23OzewnQO6hya0k9VQ5swsskra8y1lEI5Ry8
dAaYUgvL2TKgCKYFWvoZ0sY7gvNPqiHsIvvIz23YcNu6mKgirmYOO6oVc9GmV1PH
GdN9vNj7u98WtUoY4iWT6+P2pePRVkr8DOA5URzmNSEMUerNYZP/QVDnfl0NVm9/
R586HAOcHBVi1Vj7KPjY2bFPqviNLullBCPtsLWVoRGHjbNJCF48uDc66CxZ1RtT
qYRij60CKF5wJnp7HOD+C6BOuD7JoD1GOutt+m85LbMfj4CRCIIXAI3TSOjbVahn
OSu35kCJpJ/NPds8dXvploFAffVkigNXuNmwUAugvpr/lCRAIbrC9oil7PvhX0FX
y3SZ3zJHB04bspxpfZUAz8CdFdcIbvrmi/5tHE7ccGaTVONyx7/e8w9KUxUr9rhd
IpYM2HMPmTbu1udh6/CAyqYJC8mwJ9ny8t4CzKFqptB7Y6EUoA8LvWbQogSwxj6b
LObsRTKtDXM=
=2lgv
-----END PGP SIGNATURE-----

C
C
Christopher Baines wrote on 16 Sep 2022 09:32
[PATCH 2/2] marionette: Avoid read error when wait-for-file file is empty.
(address . 57850@debbugs.gnu.org)
20220916073236.23634-2-mail@cbaines.net
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(-)

Toggle diff (22 lines)
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
C
C
Christopher Baines wrote on 16 Sep 2022 09:32
[PATCH 1/2] marionette: Make it easier to debug REPL read failures.
(address . 57850@debbugs.gnu.org)
20220916073236.23634-1-mail@cbaines.net
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(-)

Toggle diff (26 lines)
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
M
M
Mathieu Othacehe wrote on 16 Sep 2022 10:37
Re: bug#57850: Marionette fix + improvement
(name . Christopher Baines)(address . mail@cbaines.net)(address . 57850@debbugs.gnu.org)
87zgezg1fw.fsf_-_@gnu.org
Hey Chris,

Toggle quote (1 lines)
> Log the remaining contnet written to the REPL, so that there's more to go on
^
content

Looks fine!

Mathieu
M
M
Mathieu Othacehe wrote on 16 Sep 2022 10:38
(name . Christopher Baines)(address . mail@cbaines.net)(address . 57850@debbugs.gnu.org)
87v8png1e7.fsf_-_@gnu.org
Toggle quote (2 lines)
> Since #<eof> can't be read.

You can maybe add:


Looks also fine,

Thanks,

Mathieu
C
C
Christopher Baines wrote on 16 Sep 2022 12:40
(name . Mathieu Othacehe)(address . othacehe@gnu.org)(address . 57850-done@debbugs.gnu.org)
87o7vfsitb.fsf@cbaines.net
Mathieu Othacehe <othacehe@gnu.org> writes:

Toggle quote (8 lines)
>> 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
-----BEGIN PGP SIGNATURE-----

iQKlBAEBCgCPFiEEPonu50WOcg2XVOCyXiijOwuE9XcFAmMkUsBfFIAAAAAALgAo
aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldDNF
ODlFRUU3NDU4RTcyMEQ5NzU0RTBCMjVFMjhBMzNCMEI4NEY1NzcRHG1haWxAY2Jh
aW5lcy5uZXQACgkQXiijOwuE9XfIGQ//fbKckTZzyQW/OG/DXMZObso8u8UR996b
RjZMKeTA2wAAild7PdwtOQJ3S1YlHSUsVSU2L0DBhAXreROjYbtt8xUFK5S7pqVE
wSY4c8RyqQmHXnH8kISi/QDPGptuuAO/6DbcHxlmxeGSLTZee/OeC+dWFl7X4CXC
0xIG9b4UWhnUFJ6Q/bOxLv0/qGC+AvLA6HZcjv936vnj09tMMx4hCiSyZI/P9jHe
q/8ElMLgc2xmu7Qpj3zMciwprdbG8rbDzyekVXXMmQHf15Ofq9K7oe+gucV+wdUk
OTMiEPz6mMeGEdc2ewxnOEP4kLGchYpm3OUg0KGYSJ6g52ZJZIqTJPxuzumjYhR7
jLYjIZbZ9vOkv9OkgxcQT09QKmBx4y9+OAmxAw7HGvLlpdUd4ib16oMM5J3SBWYJ
cZCd88dl7CKmvPdcr7hvlA2egKLizxtV2tf4jdyKFNTOvi5hMWHUQZ8gw0hj5Qkh
MIDpS385Eoio6yD8Kc/ZYlljHJyQt2+IUJGa8Qs2E73C4Lza9hZ20Y/nLwwLJ0WH
/DvAhL6QAIPpjgmDxwSInbZvt9TQFXD0qSxzGpHeEmpdhBgvhbrFSp4ld2m3o2fp
zk21CEK7keYMrzN10bfD93DD2ROFVvLfC0H+6RWD1YNSa+z6w2mYYnJJjXrpp1ci
Tc6sUtnGlX0=
=s/Ov
-----END PGP SIGNATURE-----

Closed
?