Subject: Re: bug#57095: 'terminal-window-size' throws ENOTTY ("Inappropriate ioctl for device")

From: Ludovic Courtès <[email-masked]>
Date: Fri, 02 Sep 2022 11:17:55 +0200

Hi,

Maxime Devos <[email-masked]> skribis:

> Maybe my answer on IRC is relevant here:
>
> https://logs.guix.gnu.org/guile/2022-09-01.log#231503

Interesting.

It’s a Guile bug, and a tricky one.  Here’s what Andy wrote on IRC:

<sneek> civodul, wingo says: i believe it is a bug.  in a pre-unwind handler,
	you want to make it so that if it throws again, it is handled by the
	handler that was current when the with-exception-handler was invoked
	(the dynamically outer handler)
<sneek> civodul, wingo says: to implement this, when a throw first starts, we
	capture the current handler stack, and arrange for subsequent throws
	to resolve via that captured handler stack
<sneek> civodul, wingo says: but if there is an additional
	with-exception-handler within the exception handler, that doesn't
	augment the captured exception handler stack to which inner exceptions
	will dispatch
<sneek> civodul, wingo says: the fix will be small but also gnarly :P  will
	take some thinking.  there are funny interactions with delimited
	continuations

I’ll defer to Andy to see what the best way to fix it is…

What’s frustrating is that I can’t think of a way to work around it,
except by changing ‘terminal-columns’ & co. to not use exceptions (or
introducing a variant that does that).

Thoughts?

Ludo’.