unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
From: "Ludovic Courtès" <ludo@gnu.org>
To: Josselin Poiret <dev@jpoiret.xyz>
Cc: 57095@debbugs.gnu.org, Csepp <raingloom@riseup.net>
Subject: bug#57095: 'terminal-window-size' throws ENOTTY ("Inappropriate ioctl for device")
Date: Thu, 01 Sep 2022 23:04:35 +0200	[thread overview]
Message-ID: <87bkryztzw.fsf_-_@gnu.org> (raw)
In-Reply-To: <87bkssjjt5.fsf@jpoiret.xyz> (Josselin Poiret's message of "Wed,  10 Aug 2022 15:43:18 +0200")

Hi,

Josselin Poiret <dev@jpoiret.xyz> skribis:

> We also use a big wrapping `with-error-handling` to display errors
> properly in the case when they are not caught.  The difference is that
> `with-error-handling` adds a non-unwinding handler, while catch is
> unwinding.  My first thought was that non-unwinding handlers, even outer
> ones would get priority over unwinding ones, since once the stack's
> unwound you can't really go back (I have no idea if that last part is
> actually true).  In practice this is actually false, I tested with a
> very simple example, but that lead me to test by setting `#:unwind? #t`
> for the `guard*` definition in guix/ui.scm and the issue went away, so I'm
> clueless as to why this happens.  What seems weird is that the error is
> not caught at all!

Here’s a reproducer:

--8<---------------cut here---------------start------------->8---
scheme@(guile-user)>  (with-exception-handler (lambda _ (catch 'x (lambda () (throw 'x)) (const 'good) ))
			 (lambda ()
			   (rmdir "/"))
			 #:unwind? #f)
ice-9/boot-9.scm:1685:16: In procedure raise-exception:
Throw to key `x' with args `()'.
--8<---------------cut here---------------end--------------->8---

Or, simplified:

--8<---------------cut here---------------start------------->8---
scheme@(guile-user)>  (with-exception-handler
			  (lambda _ (with-exception-handler (const 'good)
				      (lambda () (throw 'x))
				      #:unwind? #t))
			 (lambda ()
			   (rmdir "/"))
			 #:unwind? #f)
ice-9/boot-9.scm:1685:16: In procedure raise-exception:
Throw to key `x' with args `()'.
--8<---------------cut here---------------end--------------->8---

We expect 'x to be caught, leading the handler to return 'good.
Instead, 'x is not caught at all.

In both cases, setting #:unwind? #t in the outer
‘with-exception-handler’ gives the expected result.

I spent some time staring at the relevant code in ‘boot-9.scm’ but
nothing came out of it.

Ludo’.




  parent reply	other threads:[~2022-09-01 21:05 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-09 23:06 bug#57095: another "inappropriate ioctl" bug :) Csepp
2022-08-10 13:43 ` Josselin Poiret via Bug reports for GNU Guix
2022-08-10 14:53   ` Ludovic Courtès
2022-09-01 21:04   ` Ludovic Courtès [this message]
2022-09-01 21:21     ` bug#57095: 'terminal-window-size' throws ENOTTY ("Inappropriate ioctl for device") Maxime Devos
2022-09-02  9:17       ` Ludovic Courtès
2022-09-02 18:14         ` Maxime Devos

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87bkryztzw.fsf_-_@gnu.org \
    --to=ludo@gnu.org \
    --cc=57095@debbugs.gnu.org \
    --cc=dev@jpoiret.xyz \
    --cc=raingloom@riseup.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).