From 936009cfe53623c2e9fdb8f25b859600ac4dca67 Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Thu, 5 May 2022 13:22:33 +0200 Subject: [PATCH] Be more resilient towards errors during error handling * src/print.c (print_error_message): Avoid infinite recursion if `substitute-command-keys' bugs out (bug#55269). (cherry picked from commit 8364f058b821eba31f84dcded175cca403a965a5) --- src/print.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/print.c b/src/print.c index 3a26e5665e5..43ec0934ba1 100644 --- a/src/print.c +++ b/src/print.c @@ -944,7 +944,14 @@ print_error_message (Lisp_Object data, Lisp_Object stream, const char *context, errmsg = Fget (errname, Qerror_message); /* During loadup 'substitute-command-keys' might not be available. */ if (!NILP (Ffboundp (Qsubstitute_command_keys))) - errmsg = call1 (Qsubstitute_command_keys, errmsg); + { + /* `substitute-command-keys' may bug out, which would lead + to infinite recursion when we're called from + skip_debugger, so ignore errors. */ + Lisp_Object subs = safe_call1 (Qsubstitute_command_keys, errmsg); + if (!NILP (subs)) + errmsg = subs; + } file_error = Fmemq (Qfile_error, error_conditions); } -- 2.39.2