From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Thierry Volpiatto Newsgroups: gmane.emacs.bugs Subject: bug#72141: 29.4; package-upgrade vs package-load-list Date: Sat, 03 Aug 2024 03:22:37 +0000 Message-ID: <8734nmguiq.fsf@posteo.net> References: <87ikx5xulu.fsf@posteo.net> <865xsr2tn0.fsf@gnu.org> <871q3drb4v.fsf@posteo.net> <8634nt1z2k.fsf@gnu.org> <87plqxbsh4.fsf@posteo.net> <87o76c3fiq.fsf@posteo.net> Mime-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="30965"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Eli Zaretskii , Philip Kaludercic , 72141@debbugs.gnu.org To: Thierry Volpiatto Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Aug 03 05:20:02 2024 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 1sa5JK-0007ul-G8 for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 03 Aug 2024 05:20:02 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sa5J2-0003U9-MG; Fri, 02 Aug 2024 23:19:44 -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 1sa5J1-0003Tu-Jy for bug-gnu-emacs@gnu.org; Fri, 02 Aug 2024 23:19:43 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sa5J1-0001vU-9V for bug-gnu-emacs@gnu.org; Fri, 02 Aug 2024 23:19:43 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:References:In-Reply-To:From:To:Subject; bh=hUTLnO9+ZuwDs7z864yeO3kuPNfvqIdORtnAWUovy/g=; b=d57AzpeimFutYQd8wSQgWgXF0VhdIE92fB1comPwRAHHxpVcKuLlVW8gadSzbQ6kUauDiiaMulRW+KeRpDs9lXtY9ZTAY+G/mm7XYaqmV3fDr2zv7gIzZxYzJcvZgtxTTS91WXeDaCH3bVTcljKYv/elOgOkz20ObYHuXco2pCc3oKw6uTms91PPrRKyDCg6YA0mxG/lCB6GWcZYx/ySSA2NekFCfFtOp0axOZebVBD6/Ca1EsmuHy4McUsvoDvCxSAVwZ35f9NQF5iNvK0UL5+u0amuiRY/g61Z6HsLApTOLC6sRuhbUj1dGUbI05ZGukX31xs1I+s98iSJSQYpVQ==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sa5JK-0005vP-0V for bug-gnu-emacs@gnu.org; Fri, 02 Aug 2024 23:20:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Thierry Volpiatto Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 03 Aug 2024 03:20:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 72141 X-GNU-PR-Package: emacs Original-Received: via spool by 72141-submit@debbugs.gnu.org id=B72141.172265517822740 (code B ref 72141); Sat, 03 Aug 2024 03:20:01 +0000 Original-Received: (at 72141) by debbugs.gnu.org; 3 Aug 2024 03:19:38 +0000 Original-Received: from localhost ([127.0.0.1]:53939 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sa5Iv-0005ui-Vc for submit@debbugs.gnu.org; Fri, 02 Aug 2024 23:19:38 -0400 Original-Received: from mout02.posteo.de ([185.67.36.66]:43205) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sa5Is-0005uT-5c for 72141@debbugs.gnu.org; Fri, 02 Aug 2024 23:19:35 -0400 Original-Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id C4AFC240101 for <72141@debbugs.gnu.org>; Sat, 3 Aug 2024 05:19:08 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1722655148; bh=1gMr/TmVAN1XI/bpqraWsw/VscJUZFEC7vHAXEBMxlU=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type: Autocrypt:OpenPGP:From; b=IYH9jn5O2uAF3r5wIf5n8iK7GoSIw1aEjGwenNxSM7h9EBFlKVWrPq6tGq/JCgaGk LmiBlzkTcs6i2z8xyfTvJ8X2nqmSPHS3xu8dQZscyvY0AfYzzIYxZ03G6W4aXn3Dc5 H26vwU3q7gRcqUu8C3c7GC3TRquDM9hyLWNsibwayBO+fINyUVV5TVD9mdTJ8cWhGd a8A3/YIVo9xnhnM7DZr1A5Rgb/qSMNLUPw6LqTuS/I26dGQ1/HnGerod7gcEx5fGu9 OECBP8/FpegWCIXCSh06L4SDrxuS5V00wOF3BgPOUTxej29yKisZT1LsgUwN5AEiRa sObFPw3TsiJ4A== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4WbSbZ0FB5z6twx; Sat, 3 Aug 2024 05:19:05 +0200 (CEST) In-Reply-To: <87o76c3fiq.fsf@posteo.net> (Thierry Volpiatto's message of "Thu, 01 Aug 2024 06:48:13 +0000") Autocrypt: addr=thievol@posteo.net; prefer-encrypt=mutual; keydata=xsDNBF8ylcIBDADG+hy+zR6L4/vbdDDZuSaMmSrU3A5QZJpeBCvxTr7MpzzruZbhLPW1K3R6N2MA edi8Y+C8o27FVRIjpdbaKMGu9je7JV/TbUQYo3SOwCK1vM4LUn4V6ZLzSYkuiEt4eyMoiDdyvN0p kcK6P9x9DCetcEVszXzQg+yzCVrQ2hXWDXWT4M18EC3wtO7RHPouMqGiwBFhBAYErCqFWFxQHkfb tG/4yGyJ58rglb65O3qijjMWvYwcWZun9/7qm8Z4/4mHopmo2zgU+OrptnLSZfkZGz3Y7Uf452xQ GVq0Fv75NPvQru7y+DYVhuVXXyAmGxt+vf4rIiixMBbhKEPjcxEPAa2LTzex2IsTZR+QVG9uDnqC WcgaOEQ58fzXNvNhtwwF/Rgio2XWAJVdmFWS59/k9W58CIUSNKBMZh2XeGdEmtHvDtCxW3z6FJha 36RzOM3fMNNiAGdFZJA84gcdloJR+sHCDTTPT3784fjr+V8An7sI581NGFzkRQqPvEQCZbUAEQEA Ac0SdGhpZXZvbEBwb3N0ZW8ubmV0wsEOBBMBCgA4AhsDBQsJCAcCBhUKCQgLAgQWAgMBAh4BAheA FiEEI9twfRN7r3nig/xwDsVtFB0W75MFAmL3HCoACgkQDsVtFB0W75OVEAv/f6XxmtIFz08fUb8h Bp/zJP6IC4/rhhh+0GMRIRzLN8DK0jV8JCzYdFHiRJOy2lNIOpmrrCmjRRxferc2G42+ePFIsslx hU46VSz1Z83NwIG3mpdYNV5WUTUdgzxExHTNTFCd7NKv0nlHKQaA OpenPGP: url=https://posteo.de/keys/thievol@posteo.net.asc; preference=encrypt 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:289659 Archived-At: --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Thierry Volpiatto writes: > Thierry Volpiatto writes: > >> Eli Zaretskii writes: >> >>>> From: Philip Kaludercic >>>> Cc: Thierry Volpiatto , 72141@debbugs.gnu.org >>>> Date: Sun, 28 Jul 2024 11:47:44 +0000 >>>>=20 >>>> Eli Zaretskii writes: >>>>=20 >>>> >> From: Thierry Volpiatto >>>> >> Date: Tue, 16 Jul 2024 14:46:37 +0000 >>>> >>=20 >>>> >>=20 >>>> >> I think there is a bug here, but please verify with following recip= e as >>>> >> I don't use widely package installation, at least for myself. When= reading >>>> >> the code I believe it is reproductible as well on emacs-30+. >>>> >>=20 >>>> >> 1) Install package foo and bar. >>>> >> 2) Disable them in package-load-list ((foo nil) (bar nil) all). >>>> >> 3) Wait some time until foo and/or bar have new versions available. >>>> >> 4) Call package-upgrade-all. It will call package-upgrade on foo >>>> >> and bar (and possibly others). When package-upgrade find foo >>>> >> package it will (1) delete it and (2) call package-install which >>>> >> will refuse to install (error) because foo is disabled. >>>> >>=20 >>>> >> As a result we have lost foo package, it is now uninstalled. >>>> >> Same problem with M-x package-upgrade, foo and bar are listed in >>>> >> completion and made available whereas they are going to fail to >>>> >> upgrade. >>>> > >>>> > Philip, any comments or suggestions? >>>>=20 >>>> The issue is that we don't install a package if it is disabled. So >>>> either we allow installing (but don't activate) disabled packages, or = we >>>> ignore disabled packages during upgrades. >>> >>> The latter, I'd say. It makes little sense to upgrade disabled >>> packages. >> >> When I posted initially this bugreport I wrote this (fully not tested): >> >> (defun package--upgradeable-packages (&optional include-builtins fil= ter-load-list) >> ;; Initialize the package system to get the list of package >> ;; symbols for completion. >> (package--archives-initialize) >> (let ((pkgs (if include-builtins >> (append package-alist >> (mapcan >> (lambda (elt) >> (when (not (assq (car elt) package-alis= t)) >> (list (list (car elt) (package--from-= builtin elt))))) >> package--builtins)) >> package-alist)))=20 >> (cl-loop for (sym desc) in pkgs >> for available =3D (assq sym package-archive-contents) >> when (or (and available >> (or (and >> include-builtins >> (not (package-desc-version desc))) >> (version-list-< >> (package-desc-version desc) >> (package-desc-version (cadr availabl= e))) >> (and filter-load-list >> (pcase (assq p package-load-list) >> (`(,sym ,val) (or (not (eq val= nil)) >> (not (string= p val)))))))) >> (package-vc-p desc)) >> collect sym))) >> >> Perhaps package-disabled-p can be used instead of the pcase (I didn't >> know its existence). > > Here a version fixing typo and using package-disabled-p (same, still > fully untested) > Note the extra optional arg filter-load-list that allow preserving the in= itial behavior > if needed (better name?). > > (defun package--upgradeable-packages (&optional include-builtins filter-l= oad-list) > ;; Initialize the package system to get the list of package > ;; symbols for completion. > (package--archives-initialize) > (let ((pkgs (if include-builtins > (append package-alist > (mapcan > (lambda (elt) > (when (not (assq (car elt) package-alist)) > (list (list (car elt) (package--from-built= in elt))))) > package--builtins)) > package-alist)))=20 > (cl-loop for (sym desc) in pkgs > for available =3D (assq sym package-archive-contents) > for cversion =3D (and available (package-desc-version desc)) > when (or (and available > (or (and > include-builtins > (not (package-desc-version desc))) > (version-list-< > cversion > (package-desc-version (cadr available))) > (and filter-load-list > (package-disabled-p sym cversion)))) > (package-vc-p desc)) > collect sym))) > > Also there is IMO another inconsistency in package-upgrade where the > completion is done inconditionally on packages+builtins and later > package-install-upgrade-built-in is let bounded to prevent > package-install to upgrade built-in in case user chose a built-in! I finally rewrited a `package--upgradeable-packages` for helm and could test it (versions I sent previously haven't been tested and are wrong), it is working fine. I can send a patch if you want let me know. Thanks. https://github.com/emacs-helm/helm/blob/master/helm-packages.el#L266 =2D-=20 Thierry --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQHHBAEBCgAxFiEEI9twfRN7r3nig/xwDsVtFB0W75MFAmaton0THHRoaWV2b2xA cG9zdGVvLm5ldAAKCRAOxW0UHRbvk3i4DACDXPfCGI2ASE9O/O3RoyMByqbSF4qF yd5/z+W+UJcOryCozGKUFdMYwjBRIYfQHlv1ZmQr/XTEmdvCf3BG71TLNOqs+Km+ fYfSy6zyv2xBIbSxMCkerZWGlATEe2qc54hJN1V/GpKzwOnZjCVsQnolIu1MJJkI d3NCPpqVKkFQLvktj0NRYyYxD1YdcL2wnk/Qy7qnlJXDtkjLZ2I9TqCvVe8+uSMe Nz17fqYPg82z04FXgZISX4Oc3BSW3kG4Hmzac414t+hSnc9K38UyCW+0/SeZoHq7 0DsSxWFRUBdfoZfE1KlKLd4OsTiqVtW2zYbhvt6mDuE5x90Tubznju4C4SxL/NaG VXZxtpWm1+sPZ5v9KUGWs3QfJbLdspQGqEuphKykv7TaF43Y5R+IKY/IO91gbeg4 6aOc8e1FCkArO/ga5RjYIMyKBIdgasw4LIZkI4iOpKp3xkTg2KNmyPpaVCol51G9 /hNgcmKluoOCDvtf2PVHX0QbKeY5wy3NGhI= =rQ36 -----END PGP SIGNATURE----- --=-=-=--