Subject: bug#58129: 29.0.50; [PATCH] Fix (package-update) always install package due to invalid version comparison

From: lin Sun <[email-masked]>
Date: Tue, 27 Sep 2022 22:23:53 +0000

The function (package-update) should do nothing if the package already
is the latest one; but it actually always installs the package.

The issue comes from the version comparison in function
(package--updateable-packages).

In function (package--updateable-packages), it will compare the
priority versions for the achieved package and the available package,
but the archived package has NO priority version, and the will get
default 0 as its priority version, then the version comparison gets
wrong results.

This patch will fix the issue, please help to review it. Thanks.

Best Regards
Lin
From f45d1da7e6d12ec59b23073555bce95460877845 Mon Sep 17 00:00:00 2001
From: Lin Sun <[email-masked]>
Date: Tue, 27 Sep 2022 00:00:57 +0000
Subject: [PATCH] Fix (package-update) always install package due to invalid
 version comparison

* lisp/emacs-lisp/package.el (package--updateable-packages): fix
version comparison between available packages and archived packages.
---
 lisp/emacs-lisp/package.el | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
index 70c15d2..4abee9d 100644
--- a/lisp/emacs-lisp/package.el
+++ b/lisp/emacs-lisp/package.el
@@ -2189,8 +2189,8 @@ package--updateable-packages
              (assq (car elt) package-archive-contents)))
         (and available
              (version-list-<
-              (package-desc-priority-version (cadr elt))
-              (package-desc-priority-version (cadr available))))))
+              (package-desc-version (cadr elt))
+              (package-desc-version (cadr available))))))
     package-alist)))
 
 ;;;###autoload
-- 
2.7.0