Subject: bug#79200: 31.0.50; Duplicated elements for '#<marker at' in buffer-undo-list

From: Óscar Fuentes <[email-masked]>
Date: Sat, 09 Aug 2025 11:22:57 +0200

Gerd Möllmann <[email-masked]> writes:

>>> My cimpler recipe is
>>>
>>> 1. Make a new buffer x.el
>>> 2. Type an a
>>> 3. undo
>>> 4. C-h v buffer-undo-list
>>>
>>> => 
>>>
>>> Value:
>>> (nil ("a" . 1) (#<marker at 1 in x.el> . -1)
>>>      (#<marker at 1 in x.el> . -1) (#<marker at 1 in x.el> . -1)
>>>      (#<marker at 1 in x.el> . -1) (#<marker at 1 in x.el> . -1)
>>>      (#<marker at 1 in x.el> . -1) (#<marker at 1 in x.el> . -1)
>>>      (#<marker at 1 in x.el> . -1) (#<marker at 1 in x.el> . -1)
>>>      (#<marker at 1 in x.el> . -1) (#<marker at 1 in x.el> . -1)
>>>      (#<marker at 1 in x.el> . -1) (#<marker at 1 in x.el> . -1)
>>>      (#<marker at 1 in x.el> . -1) (#<marker at 1 in x.el> . -1)
>>>      (#<marker at 1 in x.el> . -1) (#<marker at 1 in x.el> . -1)
>>>      (#<marker at 1 in x.el> . -1) (#<marker at 1 in x.el> . -1)
>>>      (#<marker at 1 in x.el> . -1) nil (1 . 2) (t . 0))
>>> Local in buffer x.el; global value is nil
>>
>> I can't reproduce this with my master's build:
>>
>> emacs -Q x.el
>>
>> type an a
>>
>> undo
>>
>> C-h v buffer-undo-list
>>
>> Its value is
>> (nil (#("a" 0 1 (fontified t)) . 1) (#<marker at 1 in x.el> . -1) nil
>>      (1 . 2) (t . -1))
>> Local in buffer x.el; global value is nil
>>
>> However, doing the same with my igc build of 1 of August yields this:
>>
>> Its value is
>> (nil (#("a" 0 1 (fontified t)) . 1) (#<marker at 1 in x.el> . -1)
>>      (#<marker at 1 in x.el> . -1) (#<marker at 1 in x.el> . -1) nil
>>      (1 . 2) (t . -1))
>> Local in buffer x.el; global value is nil
>
> Now I'm completely confused. Your report had
>
> In GNU Emacs 31.0.50 (build 1, x86_64-pc-linux-gnu, X toolkit, cairo
>  version 1.18.4) of 2025-08-08 built on zen
> Repository revision: 12354bcfdc288f111c411c87e8bdebe6dcb41a4d
> Repository branch: master
>
> but it's not happending in master?

It doesn't happen here with your recipe, I need more elaborate sequences
of inputs mixed with undos/redos. I *think* that multiple undo
boundaries are a requisite.

> And I think, if didn't make a cockpit error, I tested that with master.
> Have to check this later, though.

Maybe from your build's revision to mine something changed. Or, perhaps,
there is a randomness component at play. I just executed emacs under
valgrind and it spewed lots of stuff.