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: Stefan Monnier
Subject: bug#63757: 29.0.91 order of package paths changed: random old versions of packages in load-path
Date: Sun, 04 Jun 2023 15:38:07 -0400
User-agent: Gnus/5.13 (Gnus v5.13)

> Just to make sure I am not missing something in that case:
> package-load-all-descriptors reads package descriptors either in
> alphabetical order or in the order the operating system will list them
> in the elpa/ directory.  Via package-load-descriptor, the descriptor
> expression is passed to the package-process-define-package, which will
> insert them into package-alist according to the version number.

That's right.

> If this is so, then if the package developer does not bump the commit to
> something else after releasing the package on GNU ELPA, then order of
> the VC package vs. the tarball package would depend on order in which
> they are returned from via `directory-files', since their version
> according to `version-list-=' would be the same?

If two installed packages have the same version, then indeed the sort
order between them is "arbitrary" (it currently happens to put in first
position the first package encountered, which may depend on the
directory-files sort order but also on the order the packages are found
along `package-directory-list` if they're not in the same dir).

So, to better handle the scenario you describe, we'd need/want something
like the 100% untested patch below.


        Stefan


diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
index ba0e3618f28..01936a4fe0a 100644
--- a/lisp/emacs-lisp/package.el
+++ b/lisp/emacs-lisp/package.el
@@ -698,8 +698,10 @@ package-process-define-package
         ;; If there is, insert the new package at the right place in the list.
         (while
             (if (and (cdr old-pkgs)
-                     (version-list-< version
-                                     (package-desc-version (cadr old-pkgs))))
+                     (let ((oversion (package-desc-version (cadr old-pkgs)))))
+                     (or (version-list-< version oversion)
+                         (and (equal version oversion)
+                              (package-vc-p new-pkg-desc))))
                 (setq old-pkgs (cdr old-pkgs))
               (push new-pkg-desc (cdr old-pkgs))
               nil)))






reply via email to

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