bug#81373: 31.0.90; package-upgrade and package-retention-policy

Philip Kaludercic <[email protected]> Fri, 31 Jul 2026 20:17:12 +0000
Newsgroups gmane.emacs.bugs
Message-ID <[email protected]>
Jeremy Bryant <[email protected]> writes:

> Jeremy Bryant via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <[email protected]> writes:
>
>> Philip Kaludercic <[email protected]> writes:
>>
>
>>>>> I suspect this is related to the new option, so adding Philip.
>>>>> package-retention-policy is t
>>>>
>>>> You mean to say that this is your local customisation?
>>
>> Yes, and by setting this variabel package-retention-policy to nil, it
>> restores the behaviour where upgrading all packages by 'U' in M-x
>> list-packages, works again, with all packages upgraded via this user
>> interface.  (Rather than calling package-upgrade-all as above, being
>> known to work.)
>>
>> In testing, I observe this bug on two different installations of Emacs
>> on two machines.
>>
>> When time permits, I would like to trace more precisely if it is due to
>> the particular set of packages, which is unlikely in any case.
>>
>> In the meantime, if you have suggestions to debug, I can try locally.
>>
>>
>>>>
>>>>> This function specifically hangs
>>>>> package-menu--mark-upgrades-1
>
> I have debugged the code from edebug, and narrowed it down.
> with the new option package-retention-policy set to t, it hangs on the
> last package requiring an upgrade.
> What is missing is the forward-line part of
> package-menu--mark-upgrades-1 here:
>             (cond ((null upgrade)
>                    (forward-line 1))
>
> in
>
>         (while (not (eobp))
>           (let* ((pkg-desc (tabulated-list-get-id))
>                  (upgrade (cdr (assq (package-desc-name pkg-desc) upgrades))))
>             (cond ((null upgrade)
>                    (forward-line 1))
>                   ((equal pkg-desc upgrade)
>                    (package-menu-mark-install))
>                   (t
>                    (unless (package-matches-selector-p
>                             package-retention-policy
>                             pkg-desc)
>                      (package-menu-mark-delete)))))))
>
>
>
> By changing the new option package-retention-policy back to nil, it
> enters the function package-menu-mark-delete, of which the last line is
>
> (forward-line)
>
> So what is missing is restoring that forward-line somewhere with the new option.
>
>
> When time permits I intend to write a patch but in the meantime the
> above may help others.

Thank you for investigating the issue, I have prepared a patch for
emacs-31 and have pushed it.  Closing the bug report.