Subject: bug#57115: emacs 29 ~commandp~ check function ~find-file~ loop without termination while ~find-file~ is adviced nested up to 20 level

From: Lars Ingebrigtsen <[email-masked]>
Date: Fri, 12 Aug 2022 17:27:53 +0200

Pythonora Nybon <[email-masked]> writes:

> Insert below snippet as your `init.el` and run with vanilla emacs 29 session.
>
> ``` elisp
>
> (toggle-debug-on-quit)
> ;; (toggle-frame-maximized)
> ;; (package-initialize)
> (require 'files)
> (require 'help)
> (with-temp-message
>     (substitute-command-keys
>      (format
>       "emacs %s is hang of `commandp' loop via advice to `find-file', \
> please hint `\\[keyboard-quit]' to see the backtrace."
>       emacs-major-version))
>   (dotimes (cnt 20)
>     (let ((sym (intern (format "test-advice/cnt-%s" cnt))))
>       (eval
>        `(progn
>           (defun ,sym (&rest _)
>             nil)
>           (advice-add 'find-file :before ',sym)))))
>   (commandp 'find-file))

I'm not quite sure what this code snippet is attempting to achieve, but
it does hang in Emacs 29, and it didn't in Emacs 28.

Adding Stefan to the CCs; perhaps he has some comments.