Subject: Re: bug#63236: 29.0.90; loaddefs-generate not 100% backwards compatible

From: Robert Pluim <[email-masked]>
Date: Thu, 04 May 2023 10:45:37 +0200

>>>>> On Wed, 03 May 2023 18:50:20 +0300, Eli Zaretskii <[email-masked]> said:
    Eli> But if the search for "\n\f\n;;;" fails, why should we assume that the
    Eli> search for "\n\f\n;;" will succeed?  A broken autoloads file can be
    Eli> broken in a much worse manner, no?  Is even a form-feed guaranteed?

Nothing is guaranteed, but in the only example in the wild Iʼve found where the
emacs-29 code fails, searching for only two ';' works.

    Eli> Maybe we should assume, if the search for the canonical last line
    Eli> fails, that there's no canonical last line, and just insert it
    Eli> ourselves?

Yes, but the issue here is that the code is deciding where to end the
region that itʼs deleting from an existing autoloads file. If we donʼt
do the deletion, we get duplicate entries (or maybe even a broken
autoloads file).

    Eli> What did the old code do in these cases?

Iʼm not sure. A quick read of emacs-lisp/autoloads.el in emacs-28
seems to indicate itʼs looking for ';', but I havenʼt actually tested
it.

    >> Looking at the history, the autoloads generation was rewritten for
    >> emacs-29, so this looks like a minor regression.

    Eli> Yes, loaddefs-gen.el is new, so we must fix it on the emacs-29 branch.

Then the easiest fix would be to search for two ';' instead of three.

Robert
--