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: Sat, 03 Jun 2023 10:19:24 +0000 Message-ID: <87sfb8g85v.fsf@posteo.net> References: <83y1l7gzqw.fsf@gnu.org> <87ilcb2p1l.fsf@posteo.net> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="10008"; 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 Sat Jun 03 12:20: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 1q5OMw-0002LR-QC for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 03 Jun 2023 12:20:23 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q5OMf-0007u9-VB; Sat, 03 Jun 2023 06:20:06 -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 1q5OMe-0007sI-2y for bug-gnu-emacs@gnu.org; Sat, 03 Jun 2023 06:20:04 -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 1q5OMc-0001Fx-Jg for bug-gnu-emacs@gnu.org; Sat, 03 Jun 2023 06:20:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1q5OMc-0000Pe-1b for bug-gnu-emacs@gnu.org; Sat, 03 Jun 2023 06:20:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Philip Kaludercic Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 03 Jun 2023 10:20: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.16857875761548 (code B ref 63757); Sat, 03 Jun 2023 10:20:02 +0000 Original-Received: (at 63757) by debbugs.gnu.org; 3 Jun 2023 10:19:36 +0000 Original-Received: from localhost ([127.0.0.1]:41592 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q5OMC-0000Ou-2i for submit@debbugs.gnu.org; Sat, 03 Jun 2023 06:19:36 -0400 Original-Received: from mout01.posteo.de ([185.67.36.65]:55863) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q5OM7-0000Oe-Iu for 63757@debbugs.gnu.org; Sat, 03 Jun 2023 06:19:34 -0400 Original-Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id B2B80240028 for <63757@debbugs.gnu.org>; Sat, 3 Jun 2023 12:19:25 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1685787565; bh=QNrC33IiLL3pEPyt/rbjDyR/BWTsUDw1GHiCU4uX0Ek=; h=From:To:Cc:Subject:Autocrypt:Date:Message-ID:MIME-Version: Content-Transfer-Encoding:From; b=dC6m+PF1E+4pygvRj8bP+NI5S20CcyxGt1dCtmCR03YbaRC8bSH8XeZah6D8miduR N0eYNS+DueEiErtCbJgJeHx9+nVXTiS8P0Njqq0J3kfjtjlnO/RFV5/b2wzIOscvR2 NNKN4y93KzuRLwqcuypZCi1VISB1RKorlNQUqbWQyLW7gcL49T6VygZSIp4fi+nzc5 fpoHT71kwW8J/TD1oZ8wn5jPjvYG+9w2EIny0BXPCYZt6mG0Fc1XUzR2TmZWN/xe1h +g+26KrryYTgYPXVhEGSYZ1T48xuA7glRQahTAUjQ9d4IjqkIuI9U1JKJ7zyYi+CS/ O86sDkpBC6xCQ== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4QYG7c5Vnbz6tws; Sat, 3 Jun 2023 12:19:24 +0200 (CEST) In-Reply-To: <87ilcb2p1l.fsf@posteo.net> (Philip Kaludercic's message of "Mon, 29 May 2023 14:24:54 +0000") 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:262815 Archived-At: Philip Kaludercic writes: > 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 (fo= urth 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 ve= rsion >>> > of a package in most cases, directory-files default sorting works. >>> > In emacs 29.0.91 I get old 2017 version because of NOSORT unpredictab= le >>> > 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 mo= re details, so yes I am looking at > it: > >> I sent the bug report https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D63= 757 ( >> 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: > > 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 Ping?