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

From: Robert Pluim <[email-masked]>
Date: Wed, 03 May 2023 10:40:28 +0200

>>>>> On Tue, 02 May 2023 19:06:14 +0200, Robert Pluim <[email-masked]> said:

    Robert> I attempted to upgrade my packages today using `list-packages', which
    Robert> errored out when regenerating the autoloads for vlf-write.el:

    Robert> Debugger entered--Lisp error: (search-failed "\n\f\n;;;")
    Robert>   search-forward("\n\f\n;;;")
    Robert>   loaddefs-generate("/home/rpluim/.emacs.d/elpa/vlf-20191126.2250" "/home/rpluim/.emacs.d/elpa/vlf-20191126.2250/vlf-a..." nil "(add-to-list 'load-path (or (and load-file-name (f...")
    Robert>   package-generate-autoloads(vlf "/home/rpluim/.emacs.d/elpa/vlf-20191126.2250")

The minimal patch I can come up with is this, which seems safe enough
but Iʼd appreciate it if someone who knows the code could comment

diff --git a/lisp/emacs-lisp/loaddefs-gen.el b/lisp/emacs-lisp/loaddefs-gen.el
index a966b1e9f40..c25950a1afd 100644
--- a/lisp/emacs-lisp/loaddefs-gen.el
+++ b/lisp/emacs-lisp/loaddefs-gen.el
@@ -637,7 +637,7 @@ loaddefs-generate
                       (search-backward "\f\n" nil t))
                   ;; Delete the old version of the section.
                   (delete-region (match-beginning 0)
-                                 (and (search-forward "\n\f\n;;;")
+                                 (and (re-search-forward "\n\f\n;;;?")
                                       (match-beginning 0)))
                   (forward-line -2)))
               (insert head)

Robert
--