GNU bug report logs - #6177
23.2; emacs crashes when reverting a file

Previous Next

Package: emacs;

Reported by: Roland Winkler <roland.winkler <at> physik.uni-erlangen.de>

Date: Tue, 11 May 2010 23:29:01 UTC

Severity: normal

Found in version 23.2

Done: Chong Yidong <cyd <at> stupidchicken.com>

Bug is archived. No further changes may be made.

Full log


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

From: Roland Winkler <roland.winkler <at> physik.uni-erlangen.de>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 6177 <at> debbugs.gnu.org
Subject: Re: bug#6177: 23.2; emacs crashes when reverting a file
Date: Wed, 12 May 2010 16:13:10 -0500
On Wed May 12 2010 Eli Zaretskii wrote:
> > I've encountered a situation, where reverting a file reproducibly
> > crashes emacs.  I do not know much about debugging emacs on this level.
> > I've reproduced the crash under gdb. 
> > xbacktrace doesn't give any information.
> 
> Can you show the steps to reproduce this, starting with "emacs -Q"?

I got a simpler test case that works with emacs -Q.

The point about the code below is that buffer *bar* depends on what
happens to file foo.txt visited in its own buffer: reverting buffer
*bar* really operates on the buffer visiting foo.txt.

The detailed steps to reprdouce this bug are as follows:

Create file foo.txt

cat > ~/foo.txt <<EOF
Hello world.
EOF

In "emacs -Q" load the code below. Then run my-init, touch file
foo.txt and finally move point in buffer bar which triggers
my-revert-buffer. This crashes emacs.
If the second with-current-buffer is removed from my-revert-buffer
the code runs fine.

Roland



(setq my-buffer "foo.txt")

(defun my-init ()
  (interactive)
  (find-file (concat "~/" my-buffer))
  (my-bar))

(defun my-bar ()
  (with-current-buffer (get-buffer-create "*bar*")
    (erase-buffer)
    (insert "acdef")
    (setq revert-buffer-function 'my-revert-buffer
          mode-line-buffer-identification
          (list 24 (buffer-name) "  "
                '(:eval (format "%d" (my-revert-buffer)))))
    (add-hook 'post-command-hook 'force-mode-line-update nil t)))

(defun my-revert-buffer (&optional ignore-auto noconfirm)
  "My `revert-buffer-function'."
  (when (or noconfirm
            (not (verify-visited-file-modtime (get-buffer my-buffer))))
    (with-current-buffer my-buffer
      (kill-all-local-variables)
      (let (revert-buffer-function)       ; don't loop.
        (revert-buffer ignore-auto t)))
    ;; the following two lines make emacs crash
    (with-current-buffer (get-buffer-create "*bar*")
      (erase-buffer)))
  0)




This bug report was last modified 14 years and 344 days ago.

Previous Next


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