From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs 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 Message-ID: References: <83a5xf7pi5.fsf@gnu.org> <87ttvnoehl.fsf@posteo.net> <8335377iyo.fsf@gnu.org> <87h6rnoa8v.fsf@posteo.net> <83v8g35ybo.fsf@gnu.org> <87cz2bo3qu.fsf@posteo.net> <83pm6b5t1i.fsf@gnu.org> <878rczo28v.fsf@posteo.net> <83o7lv5sjc.fsf@gnu.org> <874jnno1bi.fsf@posteo.net> <83mt1f5rab.fsf@gnu.org> <87zg5fmkgk.fsf@posteo.net> <83a5xf5k65.fsf@gnu.org> <87cz2bxkz5.fsf@posteo.net> <87v8g3t6k4.fsf@posteo.net> Reply-To: Stefan Monnier Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="33418"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Eli Zaretskii , 63757@debbugs.gnu.org, artscan@list.ru To: Philip Kaludercic Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Jun 04 21:39:22 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1q5tZQ-0008VM-TY for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 04 Jun 2023 21:39:21 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q5tZA-0005Ot-Qf; Sun, 04 Jun 2023 15:39:04 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q5tZ9-0005N8-4G for bug-gnu-emacs@gnu.org; Sun, 04 Jun 2023 15:39:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1q5tZ8-0001Ej-Sj for bug-gnu-emacs@gnu.org; Sun, 04 Jun 2023 15:39:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1q5tZ8-0004HB-DX for bug-gnu-emacs@gnu.org; Sun, 04 Jun 2023 15:39:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 04 Jun 2023 19:39:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 63757 X-GNU-PR-Package: emacs Original-Received: via spool by 63757-submit@debbugs.gnu.org id=B63757.168590749716381 (code B ref 63757); Sun, 04 Jun 2023 19:39:02 +0000 Original-Received: (at 63757) by debbugs.gnu.org; 4 Jun 2023 19:38:17 +0000 Original-Received: from localhost ([127.0.0.1]:47397 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q5tYP-0004G9-CY for submit@debbugs.gnu.org; Sun, 04 Jun 2023 15:38:17 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:5004) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q5tYN-0004Fv-Vb for 63757@debbugs.gnu.org; Sun, 04 Jun 2023 15:38:16 -0400 Original-Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 4AA3F1000C4; Sun, 4 Jun 2023 15:38:10 -0400 (EDT) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 170AD100097; Sun, 4 Jun 2023 15:38:09 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1685907489; bh=B1wkU10JnAJUPpqYt4rXGhgMAS2ieuZGoxzV66qLvwE=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=fW8eU+eK4oy6KStOPd1BHo2D2+kXs9EsUdT9k2cW3k1gtICTjQuFm9HVvNt/J153U 8ImXeyuuwMMcC4/yn8bPDPwIgRgtjj4T2lN1BTBbvxyvo2m9IIgACTIczMAt0y2JbR VsiIz5z+57MCfK30T7xL1XwDSZ0WNbwyLWv4GEoWw90S/ITv6nLPtHIi0CDvtS6GPB fCKsc6z4ZMR5OOb4HdmKL9yl5HkjhlwDPSd0zVvMhpc6PxGo6Ns68e3dH70Q5H8XwE Z6/v43Py9e/SFO33uzGbEdLhBFP+ovCGB8JQ6M+6t0qpPTY9jCSs8ZpP6HqmtJ/K0E VubesEVG1VRzg== Original-Received: from pastel (76-10-180-239.dsl.teksavvy.com [76.10.180.239]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id D04FE1202A8; Sun, 4 Jun 2023 15:38:08 -0400 (EDT) In-Reply-To: <87v8g3t6k4.fsf@posteo.net> (Philip Kaludercic's message of "Sun, 04 Jun 2023 18:40:11 +0000") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:262986 Archived-At: > 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)))