bug-guix
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#57095: another "inappropriate ioctl" bug :)


From: Ludovic Courtès
Subject: bug#57095: another "inappropriate ioctl" bug :)
Date: Wed, 10 Aug 2022 16:53:29 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.1 (gnu/linux)

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’.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]