bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#63757: 29.0.91 order of package paths changed: random old versions o


From: Philip Kaludercic
Subject: bug#63757: 29.0.91 order of package paths changed: random old versions of packages in load-path
Date: Sun, 04 Jun 2023 09:19:28 +0000

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Philip Kaludercic <philipk@posteo.net>
>> Cc: Евгений Бойков <artscan@list.ru>,
>>   monnier@iro.umontreal.ca,
>>   63757@debbugs.gnu.org
>> Date: Sun, 04 Jun 2023 07:47:50 +0000
>> 
>> Eli Zaretskii <eliz@gnu.org> writes:
>> 
>> > 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?
>> 
>> It is new, and the simplest solution that should revert the issue could
>> be just to have `package-load-all-descriptors' sort the files when
>> loading descriptors.
>
> Can you show a patch for this, please?

Whoops, I forgot to attach a diff:

diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
index 1ee39f87529..0145306dc4e 100644
--- a/lisp/emacs-lisp/package.el
+++ b/lisp/emacs-lisp/package.el
@@ -898,14 +898,22 @@ package-activate-1
 
 (defun package--get-activatable-pkg (pkg-name)
   ;; Is "activatable" a word?
-  (let ((pkg-descs (cdr (assq pkg-name package-alist))))
+  (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 source packages.
+                              (eq (package-desc-kind p1) 'vc)
+                              (not (eq (package-desc-kind p2) 'vc))
+                              ;; Prefer builtin packages.
+                              (package-disabled-p p1 v1)
+                              (not (package-disabled-p p2 v2))))))))
     ;; Check if PACKAGE is available in `package-alist'.
     (while
         (when pkg-descs
           (let ((available-version (package-desc-version (car pkg-descs))))
-            (or (package-disabled-p pkg-name available-version)
-                ;; Prefer a builtin package.
-                (package-built-in-p pkg-name available-version))))
+            (package-disabled-p pkg-name available-version)))
       (setq pkg-descs (cdr pkg-descs)))
     (car pkg-descs)))
 
>> I am not sure if the issue that Stefan raised,
>> with `sort' in `package--get-activatable-pkg' destructively modifying
>> `package-alist', but if anything that has been an issue before Emacs 29
>> as well.
>
> Евгений says that the call to 'sort' in package--get-activatable-pkg
> didn't exist before commit fb87d500.

That is true, and perhaps that could be reverted to some degree as well.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]