GNU bug report logs -
#14479
[PATCH] Infinite loop when error in auto-save-hook
Previous Next
Reported by: Kelly Dean <kellydeanch <at> yahoo.com>
Date: Mon, 27 May 2013 01:24:01 UTC
Severity: normal
Tags: patch
Fixed in version 24.4
Done: Glenn Morris <rgm <at> gnu.org>
Bug is archived. No further changes may be made.
Full log
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
Put in init.el:
(setq inhibit-startup-screen t)
(add-hook 'auto-save-hook (lambda () (error "Foo")))
(setq auto-save-interval 30)
(switch-to-buffer "*Messages*")
Start Emacs 24.3, then press any key 31 times. It prints "Foo" and begins benchmarking an autosave retry loop, on my system about 300 retries/second, because Fdo_auto_save fails when it tries to run auto-save-hook, so it never gets to record_auto_save which updates last_auto_save, which is what's supposed to prevent the retries via keyboard.c line 2608.
The patch below fixes it. Unlike the case for post-command-hook, removing the offending auto-save hook isn't vital, but I think it's the best thing to do. Anyway, continuing the autosave despite the error is vital, and safe_run_hooks is the easiest way to accomplish both.
--- emacs-24.3/src/fileio.c
+++ emacs-24.3/src/fileio.c
@@ -5445,7 +5445,7 @@
point to non-strings reached from Vbuffer_alist. */
hook = intern ("auto-save-hook");
- Frun_hooks (1, &hook);
+ safe_run_hooks (hook);
if (STRINGP (Vauto_save_list_file_name))
{
This bug report was last modified 11 years and 346 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.