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: Mon, 29 May 2023 14:24:54 +0000 Message-ID: <87ilcb2p1l.fsf@posteo.net> References: <83y1l7gzqw.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="16305"; mail-complaints-to="usenet@ciao.gmane.io" Cc: =?UTF-8?Q?=D0=95=D0=B2=D0=B3=D0=B5=D0=BD=D0=B8=D0=B9_?= =?UTF-8?Q?=D0=91=D0=BE=D0=B9=D0=BA=D0=BE=D0=B2?= , 63757@debbugs.gnu.org, Stefan Monnier To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon May 29 16:26:23 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 1q3dpG-00041A-Iw for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 29 May 2023 16:26:22 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q3dp0-0005RO-VT; Mon, 29 May 2023 10:26:07 -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 1q3dow-0005Qz-Hq for bug-gnu-emacs@gnu.org; Mon, 29 May 2023 10:26:02 -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 1q3dow-0005mP-AL for bug-gnu-emacs@gnu.org; Mon, 29 May 2023 10:26:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1q3dov-0000ig-PT for bug-gnu-emacs@gnu.org; Mon, 29 May 2023 10:26: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: Mon, 29 May 2023 14:26: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.16853703052675 (code B ref 63757); Mon, 29 May 2023 14:26:01 +0000 Original-Received: (at 63757) by debbugs.gnu.org; 29 May 2023 14:25:05 +0000 Original-Received: from localhost ([127.0.0.1]:58671 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q3do0-0000gz-SX for submit@debbugs.gnu.org; Mon, 29 May 2023 10:25:05 -0400 Original-Received: from mout02.posteo.de ([185.67.36.66]:47277) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q3dny-0000g4-1K for 63757@debbugs.gnu.org; Mon, 29 May 2023 10:25:03 -0400 Original-Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id 192CB240104 for <63757@debbugs.gnu.org>; Mon, 29 May 2023 16:24:55 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1685370296; bh=1WZt4C8nJzqZ5AhRzmxz+uD+F3wg44H2aaZqj2rximY=; h=From:To:Cc:Subject:Autocrypt:Date:Message-ID:MIME-Version:From; b=nGNVFrbCjq657XCeLcZ9pDk9juZ9jLHuFBNfsDnTIAcdab8F81RrUEC0poyZQOXU1 1ndf5BOgHbAAfTXhcjsnCtn+ELsOfNolnvROE5bjVA5Ed0G/LKTzH8Wid3qVUj3o4i 7IECjIQjZ4aqiCRfRjQR7fPH2k7LKtDPhGok85b0U5VX05WpBmZ3xJvS1tDRSCqnJ2 6gwRfUQDLXeQC3512gaJyVfReWs8ojD9iBYHm5B5oqLZAugAWRd9LD/s75yDBjYn0H vZgKvlou5AIGfAttl6++VAh4T3AnIuaLc4EMPOSJORkE9tblOmZFyCRX9khcVjU81x LaJn9ymB6kpKA== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4QVHqC1nNzz9rxB; Mon, 29 May 2023 16:24:55 +0200 (CEST) In-Reply-To: <83y1l7gzqw.fsf@gnu.org> (Eli Zaretskii's message of "Mon, 29 May 2023 14:09:59 +0300") 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:262582 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Eli Zaretskii writes: >> Date: Sun, 28 May 2023 02:30:18 +1000 >> From: =D0=95=D0=B2=D0=B3=D0=B5=D0=BD=D0=B8=D0=B9 =D0=91=D0=BE=D0=B9=D0= =BA=D0=BE=D0=B2 via "Bug reports for GNU Emacs, >> the Swiss army knife of text editors" >>=20 >> I am not confident how to classify this kind of behaviour change. >> You can see the beginning of the discussion below. >>=20 >> Briefly, if you have different versions of packages in package-user-dir = then pretest 29 loads random >> old versions of them whereas 28 loads mostly latest versions. >>=20 >> ---------- Forwarded message --------- >> From: Philip Kaludercic >> Date: Sat, May 27, 2023 at 6:23=E2=80=AFPM >> Subject: Re: emacs 04c4c578 pretest 29.0.91 >> To: =D0=95=D0=B2=D0=B3=D0=B5=D0=BD=D0=B8=D0=B9 =D0=91=D0=BE=D0=B9=D0=BA= =D0=BE=D0=B2 >>=20 >> =D0=95=D0=B2=D0=B3=D0=B5=D0=BD=D0=B8=D0=B9 =D0=91=D0=BE=D0=B9=D0=BA=D0= =BE=D0=B2 writes: >>=20 >> > Hello, Philip. >>=20 >> Hi, >>=20 >> > In your commit 04c4c578, package directories became NOSORT due to (fou= rth t >> > argument) >> > (directory-files dir) >> > replaced by >> > (directory-files dir t "^[^.]" t) >> > >> > It affects package-alist forming. For example, there are old and new >> > versions of a package in my elpa directory: >> > >> > go-mode-20170726.555 >> > go-mode-20220114.2239 >> > >> > After (package-initialize) >> > in emacs 28 (require 'go-mode) gives 2022 version, e.g. the latest ver= sion >> > of a package in most cases, directory-files default sorting works. >> > In emacs 29.0.91 I get old 2017 version because of NOSORT unpredictable >> > version order in package-alist and hence random paths in load-path. >> > >> > I just tried to move from 28 to 29.0.91 and got many errors due to old >> > versions of many packages. >> > Excuse me if it is a feature and I missed something. >>=20 >> No, this is not a feature but I think it might have uncovered a bug. >> Relying on the ordering of file names (which IIRC is lexiographic not >> numeric) is not a robust way to decide what packages should be preferred >> when loading descriptors. Could you submit a bug report to >> bug-gnu-emacs@gnu.org so that this issue can be discussed with the other >> maintainers? > > Philip, are you looking into this? Or do you have any comments? =D0=95=D0=B2=D0=B3=D0=B5=D0=BD=D0=B8=D0=B9 sent me a message with some more= details, so yes I am looking at it: > I sent the bug report https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D637= 57 ( > 63757@debbugs.gnu.org) and did more research. > It turned out that the final ordering is defined (fb87d5) by > (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)))))))) > > So I can fix it like this > > (sort (cdr (assq 'go-mode package-alist)) > (lambda (p1 p2) > (let ((v1 (package-desc-version p1)) > (v2 (package-desc-version p2))) > (or > (not (version-list-< v1 v2)) > )))) > > But I still can't understand how to fix it along with builtin and VC > preferred ordering. Won't this work: --=-=-= Content-Type: text/plain Content-Disposition: inline diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index 01826da273d..7eb185e7042 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -927,7 +927,9 @@ package--get-activatable-pkg (package-vc-p p2) ;; Prefer builtin packages. (package-disabled-p p1 v1) - (not (package-disabled-p p2 v2)))))))) + (not (package-disabled-p p2 v2)) + ;; Prever newer packages + (version-list-< v2 v1))))))) ;; Check if PACKAGE is available in `package-alist'. (while (when pkg-descs --=-=-=--