From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Philip Kaludercic 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 16:15:10 +0000 Message-ID: <87cz2bxkz5.fsf@posteo.net> References: <87sfb8g85v.fsf@posteo.net> <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> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="6780"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Eli Zaretskii , 63757@debbugs.gnu.org, artscan@list.ru To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Jun 04 18:16:40 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 1q5qPH-0001Zi-Ni for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 04 Jun 2023 18:16:39 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q5qOz-0005fL-G9; Sun, 04 Jun 2023 12:16:21 -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 1q5qOj-0005ea-Ab for bug-gnu-emacs@gnu.org; Sun, 04 Jun 2023 12:16:11 -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 1q5qOg-0004SB-EP for bug-gnu-emacs@gnu.org; Sun, 04 Jun 2023 12:16:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1q5qOf-0006X3-SN for bug-gnu-emacs@gnu.org; Sun, 04 Jun 2023 12:16:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Philip Kaludercic Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 04 Jun 2023 16:16:01 +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.168589531925033 (code B ref 63757); Sun, 04 Jun 2023 16:16:01 +0000 Original-Received: (at 63757) by debbugs.gnu.org; 4 Jun 2023 16:15:19 +0000 Original-Received: from localhost ([127.0.0.1]:46955 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q5qNz-0006Vf-AL for submit@debbugs.gnu.org; Sun, 04 Jun 2023 12:15:19 -0400 Original-Received: from mout01.posteo.de ([185.67.36.65]:56467) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q5qNx-0006VO-7L for 63757@debbugs.gnu.org; Sun, 04 Jun 2023 12:15:18 -0400 Original-Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id AF940240028 for <63757@debbugs.gnu.org>; Sun, 4 Jun 2023 18:15:11 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1685895311; bh=Yp4lnPgJqdsLXm4hflC01+Kh/lzdroD0cMl5/t5pon8=; h=From:To:Cc:Subject:Autocrypt:Date:Message-ID:MIME-Version:From; b=eCJ1VLON0R+Ai6F8mOHfFkHqd+qOD1ahpMj73rZkVIjwz5nRCkbRRm1JPfy6cHVsN 1/jEmE6WdedNsrdm638rxHixMqKJraHpF+hxJ+cKe5qHnkxX/4zcyYDw6f8EZzKMZC nACDknjkoloc67jFmYZdecFkpmUFkIzc1TJe+Yc1cGYRtYBkK+akvn0Dg0uDgqV4MK M4Vpf7dqZcDWsc1oXOksDGNwB4gH9ZVPLX0yrn1fPqghHrM/O9FW6EFDXLN6nXrra0 c25A7SRerwEm2BAcMjrX9mpgC/CC+L32h9TCMggHrdy4Ou+cni5rhVIVjlpYcQWbdV 5LWPSuP9US3jA== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4QZ1zf50SPz6tsB; Sun, 4 Jun 2023 18:15:10 +0200 (CEST) In-Reply-To: (Stefan Monnier's message of "Sun, 04 Jun 2023 11:47:15 -0400") Autocrypt: addr=philipk@posteo.net; keydata= mDMEZBBQQhYJKwYBBAHaRw8BAQdAHJuofBrfqFh12uQu0Yi7mrl525F28eTmwUDflFNmdui0QlBo aWxpcCBLYWx1ZGVyY2ljIChnZW5lcmF0ZWQgYnkgYXV0b2NyeXB0LmVsKSA8cGhpbGlwa0Bwb3N0 ZW8ubmV0PoiWBBMWCAA+FiEEDg7HY17ghYlni8XN8xYDWXahwukFAmQQUEICGwMFCQHhM4AFCwkI BwIGFQoJCAsCBBYCAwECHgECF4AACgkQ8xYDWXahwulikAEA77hloUiSrXgFkUVJhlKBpLCHUjA0 mWZ9j9w5d08+jVwBAK6c4iGP7j+/PhbkxaEKa4V3MzIl7zJkcNNjHCXmvFcEuDgEZBBQQhIKKwYB BAGXVQEFAQEHQI5NLiLRjZy3OfSt1dhCmFyn+fN/QKELUYQetiaoe+MMAwEIB4h+BBgWCAAmFiEE Dg7HY17ghYlni8XN8xYDWXahwukFAmQQUEICGwwFCQHhM4AACgkQ8xYDWXahwukm+wEA8cml4JpK NeAu65rg+auKrPOP6TP/4YWRCTIvuYDm0joBALw98AMz7/qMHvSCeU/hw9PL6u6R2EScxtpKnWof z4oM 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:262969 Archived-At: Stefan Monnier writes: >> I'd need to see the actual patch, but right now I'm inclined to leave >> this problem unsolved in Emacs 29. It only happens for people who >> don't uninstall older versions of packages they install, and that's >> not the workflow we support in Emacs 29. The offending code was with >> us since Aug 2022, so replacing it with something at the last moment >> needs a very good reason. > > Actually, here's the patch that I'd suggest. > It reverts the code to its Jan 2021 state, which, in my book, makes it > safe enough. > > The current sort predicate is quite severely broken, so "no sort" can't > be worse (especially since the list is supposed to be sorted already). > Also it re-instates the "prefer a builtin package" which was lost along > the way. Together with the sorting patch from above, it seems this would also work for VC packages, since "foo" is always listed before "foo-...". > Stefan > > > diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el > index 8f266186d5e..7d5946fbfa9 100644 > --- a/lisp/emacs-lisp/package.el > +++ b/lisp/emacs-lisp/package.el > @@ -924,22 +924,14 @@ package-activate-1 > > (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 (cdr (assq pkg-name package-alist)))) > ;; Check if PACKAGE is available in `package-alist'. > (while > (when pkg-descs > (let ((available-version (package-desc-version (car pkg-descs)))) > - (package-disabled-p pkg-name available-version))) > + (or (package-disabled-p pkg-name available-version) > + ;; Prefer a builtin package. > + (package-built-in-p pkg-name available-version)))) > (setq pkg-descs (cdr pkg-descs))) > (car pkg-descs))) -- Philip Kaludercic