Sort didn't exist before fb87d500

-  (let ((pkg-descs (cdr (assq pkg-name package-alist))))
+  (let ((pkg-descs (sort (cdr (assq pkg-name package-alist))

We can fix incorrect sorting

diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
index ba0e3618f28..228d77b54e7 100644
--- a/lisp/emacs-lisp/package.el
+++ b/lisp/emacs-lisp/package.el
@@ -916,17 +916,18 @@ correspond to previously loaded files."
 
 (defun package--get-activatable-pkg (pkg-name)
   ;; Is "activatable" a word?
-  (let ((pkg-descs (sort (cdr (assq pkg-name package-alist))
-                         (lambda (p1 p2)
-                           (let ((v1 (package-desc-version p1))
-                                 (v2 (package-desc-version p2)))
-                             (or
-                              ;; Prefer VC packages.
-                              (package-vc-p p1)
-                              (package-vc-p p2)
-                              ;; Prefer builtin packages.
-                              (package-disabled-p p1 v1)
-                              (not (package-disabled-p p2 v2))))))))
+  (let ((pkg-descs
+         ;; Prefer VC packages
+         (apply 'append
+                (cl-reduce
+                 (lambda (p1 p2)
+                   (if (package-vc-p p1)
+                       (push p1 (cl-first p2))
+                     (push p1 (cl-second p2)))
+                   p2)
+                 (cdr (assq pkg-name package-alist))
+                 :initial-value (list nil nil)
+                 :from-end t))))
     ;; Check if PACKAGE is available in `package-alist'.
     (while
         (when pkg-descs

or just revert fb87d500

On Sun, Jun 4, 2023 at 3:41 PM Eli Zaretskii <eliz@gnu.org> wrote:
> From: Евгений Бойков <artscan@list.ru>
> Date: Sun, 4 Jun 2023 15:37:31 +1000
> Cc: Philip Kaludercic <philipk@posteo.net>, Eli Zaretskii <eliz@gnu.org>, 63757@debbugs.gnu.org
>
> Excuse me for extra messages, I've already found a bug in the previous patch.
> I need a review, especially with in-place operations.
>
> move "Prefer VC packages" to `package-process-define-package`
> drop `package-disabled-p` and "Prefer builtin packages" comment

Thanks, but I'm not really comfortable with such non-trivial changes
in package.el at this late stage of the pretest.

Is this problem new in Emacs 29, or did it exist in Emacs 28 as well?
If it is new, which change(s) caused the incorrect ordering of
versions in Emacs 29?


--
__________________________

С уважением,
Бойков Евгений Алексеевич
сот. 8-924-202-25-65
e-mail: artscan@list.ru