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: another "inappropriate ioctl" bug :)
Date: Wed, 10 Aug 2022 16:53:29 +0200 [thread overview]
Message-ID: <87lerwywt2.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!
The inner handler, even if it’s unwinding and the outer one is not,
appears to have higher precedence:
--8<---------------cut here---------------start------------->8---
scheme@(guix read-print)> (with-exception-handler (lambda args (pk 'outer args))
(lambda ()
(with-exception-handler
(lambda args (pk 'inner args))
(lambda()
(rmdir "/"))
#:unwind? #t))
#:unwind? #f)
;;; (inner (#<&compound-exception components: (#<&external-error> #<&origin origin: "rmdir"> #<&message message: "~A"> #<&irritants irritants: ("Device or resource busy")> #<&exception-with-kind-and-args kind: system-error args: ("rmdir" "~A" ("Device or resource busy") (16))>)>))
$17 = (#<&compound-exception components: (#<&external-error> #<&origin origin: "rmdir"> #<&message message: "~A"> #<&irritants irritants: ("Device or resource busy")> #<&exception-with-kind-and-args kind: system-error args: ("rmdir" "~A" ("Device or resource busy") (16))>)>)
scheme@(guix read-print)> (with-exception-handler (lambda args (pk 'outer args))
(lambda ()
(catch 'system-error
(lambda ()
(rmdir "/"))
(lambda args
(pk 'inner args))))
#:unwind? #f)
;;; (inner (system-error "rmdir" "~A" ("Device or resource busy") (16)))
$18 = (system-error "rmdir" "~A" ("Device or resource busy") (16))
--8<---------------cut here---------------end--------------->8---
This appears to work:
--8<---------------cut here---------------start------------->8---
scheme@(guile-user)> ,use(guix build syscalls)
scheme@(guile-user)> (terminal-columns)
$19 = 119
scheme@(guile-user)> ,use(guix ui)
scheme@(guile-user)> (with-error-handling (terminal-columns))
$20 = 119
scheme@(guile-user)> (terminal-columns (open-input-string ""))
$21 = 143
scheme@(guile-user)> (with-error-handling (terminal-columns (open-input-string "")))
$22 = 143
--8<---------------cut here---------------end--------------->8---
Needs more investigation…
Ludo’.
next prev parent reply other threads:[~2022-08-10 14:54 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 [this message]
2022-09-01 21:04 ` bug#57095: 'terminal-window-size' throws ENOTTY ("Inappropriate ioctl for device") Ludovic Courtès
2022-09-01 21:21 ` 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=87lerwywt2.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).