Subject: bug#49132: guix substitute: backtrace when the network is disabled during substitution

From: Ludovic Courtès <[email-masked]>
Date: Tue, 22 Jun 2021 16:06:02 +0200

Hi,

Maxime Devos <[email-masked]> skribis:

> so I disabled & re-enabled wireless networking during the substitution
> and encountered a (to my knowledge) previously-unknown backtrace:
>
> $ while (echo substitute /gnu/store/44h13hn5zssfppz67vydxcf95qsc8qfw-libreoffice-6.4.7.2 /tmp/t && echo substitute /gnu/store/j0j7z6ckarjs9yi77sncszbmdgy38s70-guix-1.3.0-4.4985a42 /tmp/u) | guix
> substitute --substitute ; do chmod -R +w /tmp/t && rm -rf /tmp/t && chmod -R +w /tmp/u && rm -rf /tmp/u ; done

[...]

> In lzlib.scm:
>     501:4  9 (lzread! #<lz-decoder 7f0d0b7d5ef0> #<input: string 7f…> …)
> In unknown file:
>            8 (get-bytevector-n #<input: string 7f0d0b7d3e70> 65537)
> In guix/progress.scm:
>    368:31  7 (read! _ _ _)
> In unknown file:
>            6 (get-bytevector-n! #<input: string 7f0d0a15e4d0> # 0 #)
> In web/response.scm:
>      95:2  5 (read! _ _ _)
> In ice-9/boot-9.scm:
>   1685:16  4 (raise-exception _ #:continuable? _)
>   1685:16  3 (raise-exception _ #:continuable? _)
>   1780:13  2 (_ #<&compound-exception components: (#<&error> #<&irri…>)
>   1685:16  1 (raise-exception _ #:continuable? _)
>   1685:16  0 (raise-exception _ #:continuable? _)
>
> ice-9/boot-9.scm:1685:16: In procedure raise-exception:
> Throw to key `bad-response' with args `("EOF while reading response body: ~a bytes of ~a" (26017808 37842870))'.

Ah indeed, this is poorly handled.

I’m not really sure how to address it.  I/O ports are a nice abstraction
as it allows you to transparently read “streams” from any medium, but as
always, that also comes with opacity where the call site is not supposed
to know what kind of exceptions might be thrown deep down.

Thoughts?

Ludo’.