GNU bug report logs - #16377
Undo Tree regression: (error "Unrecognized entry in undo list undo-tree-canary")

Previous Next

Package: emacs;

Reported by: Barry OReilly <gundaetiapo <at> gmail.com>

Date: Tue, 7 Jan 2014 00:33:02 UTC

Severity: normal

Merged with 16523

Done: Barry OReilly <gundaetiapo <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Barry OReilly <gundaetiapo <at> gmail.com>
Subject: bug#16377: closed (Re: bug#16377: Undo Tree regression: (error
 "Unrecognized entry in undo list undo-tree-canary"))
Date: Wed, 22 Jan 2014 15:27:03 +0000
[Message part 1 (text/plain, inline)]
Your bug report

#16377: Undo Tree regression: (error "Unrecognized entry in undo list undo-tree-canary")

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to 16377 <at> debbugs.gnu.org.

-- 
16377: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=16377
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Barry OReilly <gundaetiapo <at> gmail.com>
To: Toby Cubitt <toby-dated-1391609828.ede38b <at> dr-qubit.org>,
 16377-done <at> debbugs.gnu.org
Subject: Re: bug#16377: Undo Tree regression: (error "Unrecognized entry in
 undo list undo-tree-canary")
Date: Wed, 22 Jan 2014 10:26:05 -0500
[Message part 3 (text/plain, inline)]
On Wed, Jan 22, 2014 at 9:17 AM, Toby Cubitt <
toby-dated-1391609828.ede38b <at> dr-qubit.org> wrote:

> On Tue, Jan 21, 2014 at 07:05:38PM -0500, Barry OReilly wrote:
> > > The "Unrecognised entry" error suggests the undo-tree-canary symbol
> > > has somehow ended up in a `buffer-undo-tree' entry.
> >
> > You mean "buffer-undo-list" not "buffer-undo-tree" right?
>
> No, I mean `buffer-undo-tree'. The canary should never end up there. In
> undo-tree-mode, primitive-undo only ever gets called on an entry copied
> from buffer-undo-tree. Hence my statement, above.
>
> > I checked Emacs 24.3 and as I suspected it's quite easy to make
> > undo-tree-canary appear in the buffer-undo-list.
>
> It's *supposed* to be in buffer-undo-list. It's not supposed to ever be
> in buffer-undo-tree. (And maybe it isn't, I'm just guessing from the
> error message here. I haven't had time to investigate yet.)
>
> > What changed is the error checking in core Emacs. If you expected that
> > undo-tree-canary would never be there between commands, that has not
> > been so for some time.
>
> I didn't expect that.
>
> > Could you tell me more about the purpose of undo-tree-canary?
>
> It lets undo-tree-mode detect when Emacs has discarded undo history from
> buffer-undo-list "behind undo-tree-mode's back". If the canary has
> vanished when undo-tree-mode looks at buffer-undo-list, Emacs must have
> purged some undo history.
>
> The new error checking in primitive-undo shouldn't affect undo-tree-mode
> in any way. I still strongly suspect this is a bug in the very delicate
> and relatively untested undo-in-region code, and the change to
> primitive-undo is a red herring.
>
>
In undo-tree-redo-1:

  (setf (undo-tree-node-undo current)
        (undo-list-pop-changeset 'discard-pos))

In undo-list-pop-changeset:

  (if (eq (car buffer-undo-list) 'undo-tree-canary)
      (push nil buffer-undo-list)
    [...])

The push call returns (nil 'undo-tree-canary). This is how it gets
into the buffer-undo-tree in my reproduction.

I'll close the Emacs bug since we're fairly sure at this point it's an
undo-tree bug.
[Message part 4 (text/html, inline)]
[Message part 5 (message/rfc822, inline)]
From: Barry OReilly <gundaetiapo <at> gmail.com>
To: toby-undo-tree <at> dr-qubit.org, bug-gnu-emacs <at> gnu.org
Subject: Undo Tree regression: (error "Unrecognized entry in undo list
 undo-tree-canary")
Date: Mon, 6 Jan 2014 19:32:45 -0500
[Message part 6 (text/plain, inline)]
Don't know yet if the code change belongs in Undo Tree or Emacs but
the recipe is:

  • Start Emacs in scratch buffer with global-undo-tree-mode enabled
  • Go to BOB and insert "xxx"
  • Select first line
  • undo-tree-undo in region
  • undo-tree-redo in region
  • undo-tree-visualize
  • Navigate down (redo)*
  • Navigate up (undo)

Upon the navigate up, this error occurs:

  Debugger entered--Lisp error: (error "Unrecognized entry in undo list
undo-tree-canary")
     signal(error ("Unrecognized entry in undo list undo-tree-canary"))
     error("Unrecognized entry in undo list %S" undo-tree-canary)
     primitive-undo(1 (undo-tree-canary))
     undo-tree-undo-1(1)
     undo-tree-visualize-undo(1)
     call-interactively(undo-tree-visualize-undo nil nil)
     command-execute(undo-tree-visualize-undo)

* Sometimes the navigate down hangs with backtrace:

  Debugger entered--Lisp error: (quit)
     undo-tree-copy-list((nil))
     undo-tree-redo-1(1)
     undo-tree-visualize-redo(1)
     call-interactively(undo-tree-visualize-redo nil nil)
     command-execute(undo-tree-visualize-redo)

Don't know if it's related or not.

This recipe does not cause a problem with Emacs 24.3.

The following commit is suspicious:

commit 0c180ea96c022923ef18a255d0492bdb5ad04e02
Author: Aaron S. Hawley <aaron.s.hawley <at> gmail.com>
Date:   Tue Jan 8 14:13:31 2013 -0500

    * lisp/simple.el (primitive-undo): Move from undo.c.
    * src/undo.c (Fprimitive_undo): Move to simple.el.
    (syms_of_undo): Remove declaration for Sprimitive_undo.
    * test/automated/undo-tests.el: New file.

The commit moved primitive-undo from C to Elisp. In the process, it
added an else condition not present in the C code:

+             (t (error "Unrecognized entry in undo list %S" next)))))

The consequence of this bug is that when using Undo Tree, recent undo
history can become completely inaccessible.

I should note that if I don't undo in region, Undo Tree has never run
into any problems with the Emacs on trunk.
[Message part 7 (text/html, inline)]

This bug report was last modified 8 years and 12 days ago.

Previous Next


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