GNU bug report logs - #14479
[PATCH] Infinite loop when error in auto-save-hook

Previous Next

Package: emacs;

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.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 14479 in the body.
You can then email your comments to 14479 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#14479; Package emacs. (Mon, 27 May 2013 01:24:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Kelly Dean <kellydeanch <at> yahoo.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Mon, 27 May 2013 01:24:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Kelly Dean <kellydeanch <at> yahoo.com>
To: bug-gnu-emacs <at> gnu.org
Subject: [PATCH] Infinite loop when error in auto-save-hook
Date: Sun, 26 May 2013 18:21:32 -0700 (PDT)
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))
     {





Reply sent to Glenn Morris <rgm <at> gnu.org>:
You have taken responsibility. (Thu, 13 Jun 2013 05:14:02 GMT) Full text and rfc822 format available.

Notification sent to Kelly Dean <kellydeanch <at> yahoo.com>:
bug acknowledged by developer. (Thu, 13 Jun 2013 05:14:03 GMT) Full text and rfc822 format available.

Message #10 received at 14479-done <at> debbugs.gnu.org (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: 14479-done <at> debbugs.gnu.org
Subject: Re: bug#14479: [PATCH] Infinite loop when error in auto-save-hook
Date: Thu, 13 Jun 2013 01:13:36 -0400
Version: 24.4

Thanks; applied.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 11 Jul 2013 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 10 years and 300 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.