GNU bug report logs -
#33034
`unwind-protect' cleanup form is not executed if body dies in stack overflow
Previous Next
Full log
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
To reproduce:
(defun overflow ()
(overflow))
(defun test ()
(interactive)
(message "BEFORE")
(unwind-protect
(overflow)
(message "CLEANUP")))
Invocation of `test' never issues message "CLEANUP", whether it is run
interactively or non-interactively.
By comparison, if you _catch_ the error with `condition-case':
(defun test-2 ()
(interactive)
(message "BEFORE")
(unwind-protect
(ignore-errors (overflow))
(message "CLEANUP")))
then cleanup form is executed properly.
But if your error catcher is "above" the `unwind-protect' form, the
cleanup is not executed again, even though the error is eaten as
expected:
(defun test-3 ()
(interactive)
(message "BEFORE")
(ignore-errors
(unwind-protect
(overflow)
(message "CLEANUP"))))
This is a perfect way to screw up your Emacs permanently (until full
restart): when some `unwind-protect' cleanups are not run, you can be
left with unexpected function advices, permanently altered global
state etc., without any good way to undestand what's wrong.
Paul
This bug report was last modified 6 years and 222 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.