From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.devel Subject: Re: Stability of core packages (was: Not easy at all to upgrade :core packages like Eglot) Date: Thu, 20 Apr 2023 02:25:00 +0300 Message-ID: References: <87a5zj2vfo.fsf@gmail.com> <83y1mue1qi.fsf@gnu.org> <83sfd2e01f.fsf@gnu.org> <1a5e5837-513b-84d8-3260-cdbf42b71267@gutov.dev> <83sfcz9rf2.fsf@gnu.org> <09a49ab9-ac72-36a9-3e68-9c633710eba7@gutov.dev> <83r0sh8i1q.fsf@gnu.org> <35638c9d-e13f-fad8-5f95-ea03d65d4aa2@gmail.com> <87a5z3izst.fsf@web.de> <83v8hr7qk9.fsf@gnu.org> <83pm7z7nkc.fsf@gnu.org> <4b63ef62-5e1c-3dcf-ec7b-06b69e79133b@gutov.dev> <83o7nj7mfn.fsf@gnu.org> <556e0fbb-215e-c11d-0e8b-73e97441abbb@gutov.dev> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="21869"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.10.0 Cc: Eli Zaretskii , arne_bab@web.de, jporterbugs@gmail.com, emacs-devel To: =?UTF-8?B?Sm/Do28gVMOhdm9yYQ==?= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Apr 20 01:26:00 2023 Return-path: Envelope-to: ged-emacs-devel@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 1ppHBX-0005Rp-LU for ged-emacs-devel@m.gmane-mx.org; Thu, 20 Apr 2023 01:26:00 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ppHAm-0001wv-MH; Wed, 19 Apr 2023 19:25:12 -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 1ppHAk-0001us-JX for emacs-devel@gnu.org; Wed, 19 Apr 2023 19:25:10 -0400 Original-Received: from new4-smtp.messagingengine.com ([66.111.4.230]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ppHAg-0004wF-Ed; Wed, 19 Apr 2023 19:25:09 -0400 Original-Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailnew.nyi.internal (Postfix) with ESMTP id 196DE582258; Wed, 19 Apr 2023 19:25:04 -0400 (EDT) Original-Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Wed, 19 Apr 2023 19:25:04 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gutov.dev; h=cc :cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to; s=fm2; t= 1681946704; x=1681950304; bh=NJHKWF2aACzcO37d9MQc/1v5awHmj30mytm KFuiQG1U=; b=XkjW4EaEGcc8S/qSX4tuqSnFLjj8EV2ZwMpZ4tS1QDBjqjM+dmd GNzUzLLc1MypmQH3MedCpyUev7kn1meP6YftvEX+n4vI75ODBwPHE/BEPBQuQw5q 6AdZ/RnSKhX6tnpt+SWcg/hsM6BVFxZJn4khga7jqv6VhpKXsQPWkMCCyYoktrh3 exR86jHcxGmV1nC7GDHLotehZinWrWfsm5keVI73PVDw9sijWpdTGm1OoaVEG0mq p29mh+bydrbwIg8g+jG9bGdMDSqIztrfmvpibZJuQZtjxTkKRTHAziZxCQRqpKRw a3yEt/+UJkO7dh2tXkIdVnRnsXWXHxZFqzg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t= 1681946704; x=1681950304; bh=NJHKWF2aACzcO37d9MQc/1v5awHmj30mytm KFuiQG1U=; b=WLNvoxb//rjnuZ1HfzZPccpxpk5hvveT3qXdt8RhatvFomj64x6 ZZZ0mHPdh0y1H5bKiPYuJoTjIZJHXExmN0FaWhlh9y+O/16n2ghR7ScME6f51XEC 7Ic0G/B6aOMf+HtNotBCLUliD10jnA7S3Kt7oL4FBuE6rWComgCVYEnWFQDuBXMw PT7n9OFB1u1UgMV27fg64LcqXP+zQd77F++Bu5ydOCXXygHRmzcOrAwfaPUPfHSQ dWPYWU+utIJFpxeCf731VsGW6/orS4q3ZXrMFpQpeDSoUEqtPYvJ4eexD8ynFSrv YXVDmqjdpZrwRSpoGBUPLRH6mWGBBb7hvsA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrfedtuddgvdduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepkfffgggfuffvvehfhfgjtgfgsehtkeertddtfeejnecuhfhrohhmpeffmhhi thhrhicuifhuthhovhcuoegumhhithhrhiesghhuthhovhdruggvvheqnecuggftrfgrth htvghrnhepvdetffektdfftdelledtgedtuddufffhvdeilefgfedujefhheeiueeugfeh geeunecuffhomhgrihhnpehgnhhurdhorhhgnecuvehluhhsthgvrhfuihiivgeptdenuc frrghrrghmpehmrghilhhfrhhomhepughmihhtrhihsehguhhtohhvrdguvghv X-ME-Proxy: Feedback-ID: i0e71465a:Fastmail Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 19 Apr 2023 19:25:01 -0400 (EDT) Content-Language: en-US In-Reply-To: Received-SPF: pass client-ip=66.111.4.230; envelope-from=dmitry@gutov.dev; helo=new4-smtp.messagingengine.com X-Spam_score_int: -53 X-Spam_score: -5.4 X-Spam_bar: ----- X-Spam_report: (-5.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, NICE_REPLY_A=-2.597, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:305477 Archived-At: Not sure about the reason emacs-devel was lost from Cc. That could be my fault: I removed it before sending the first version of the grandparent email, but then I thought I managed to abort that delivery and resend it properly. Anyway, adding it back and replying with a full quote. On 20/04/2023 01:49, João Távora wrote: > On Wed, Apr 19, 2023 at 11:01 PM Dmitry Gutov wrote: > >> I think one of the conclusions to be made here is that even if >> (package-install 'eglot) now installs the newest version of Eglot in >> Emacs 29, >> >> (use-package 'eglot :ensure t) >> >> still won't do that in Emacs 29 because (package-installed-p 'eglot) >> returns t still. So the commit 580d8278c5f48 doesn't help with your >> "most common upgrade method" cited below, if they rely on use-package >> instead of calling 'package-install' directly. > > Right, that's likely. > >> The patch I +1'd here https://debbugs.gnu.org/62720#467 wouldn't help >> with (use-package 'eglot :ensure t) either, IIUC. > > That's also likely. So we'd need this: > > diff --git a/lisp/use-package/use-package-ensure.el > b/lisp/use-package/use-package-ensure.el > index e0ea982594e..95e6a9e95d5 100644 > --- a/lisp/use-package/use-package-ensure.el > +++ b/lisp/use-package/use-package-ensure.el > @@ -160,7 +160,9 @@ use-package-ensure-elpa > (when (consp package) > (use-package-pin-package (car package) (cdr package)) > (setq package (car package))) > - (unless (package-installed-p package) > + (when (or (and (memq package package--safely-upgradeable-builtins) > + (not (assoc 'eglot (package--alist)))) > + (not (package-installed-p package))) > (condition-case-unless-debug err > (progn > (when (assoc package (bound-and-true-p All right, this part would "fix" (use-package eglot :ensure t). >> Do we want to change the semantics of 'package-install' just so the >> (minor) fraction of users who call this function directly will get Eglot >> upgraded when starting over from an empty config with Emacs 29? And/or >> change (package-installed-p 'eglot) to return nil when the appropriate >> user option is set? I'm not sure that's wise, certainly not the latter. > > We don't _have_ to change the semantics. We can get exactly the same > semantics if we want to. Patch below: What kind of semantics do we get with it? 1. (use-package eglot :ensure t) considers select builtin packages to be "not installed" for the purposes of ":ensure t". 2. 'M-x package-install' allows installing them. It doesn't allow installing any other package for which (package-installed-p 'xxx) returns t, but allows installing (essentially upgrading) these ones (either just eglot, or both eglot and use-package). 3. 'M-x package-update RET eglot RET' still doesn't work unless eglot has been "upgraded" at least once via other means. Is that logical? Is even just 1+2 logical? And what about capabilities that we lose that way? I guess one of the reasons to bundle ELPA packages is to make sure they can be used without additional installation. E.g. in some Internes-less network, or one that's firewalled off. Let's also imagine that (for example) clangd is already installed through other means, which is also within the realm of possibility. And take use-package. Which some people position as the new way to write the Emacs configuration. The user puts the snippet which they saw on the Internet (use-package eglot :ensure t) either because they think it's a good idea, or because they intend to add some actual config in there, restart Emacs and... startup fails because the package can't be installed (no connection). Should they remove ":ensure t"? Perhaps. But the documentation says that that option checks that the package is "installed automatically if not already present on your system". Seems legit, right? Why would startup fail when Eglot is already present on the system? Or, to put it another way, why did we decide to bundle Eglot with Emacs if the first thing we're going to do is to try to download it anyway? So... I understand the problem, but I think we shouldn't change the functions in a way that makes them conflict with documentation or with each other. > diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el > index 685f983e285..850f4ad3a7a 100644 > --- a/lisp/emacs-lisp/package.el > +++ b/lisp/emacs-lisp/package.el > @@ -652,6 +652,12 @@ package--builtins > name (a symbol) and DESC is a `package--bi-desc' structure.") > (put 'package--builtins 'risky-local-variable t) > > +(defvar package--safely-upgradeable-builtins '(eglot use-package)) > + > +(defun package--safely-upgradeable-builtin (p) > + (and (memq p package--safely-upgradeable-builtins) ; whitelisted > + (not (assoc p (package--alist))))) ; not installed already > + > (defvar package-alist nil > "Alist of all packages available for activation. > Each element has the form (PKG . DESCS), where PKG is a package > @@ -2201,14 +2207,18 @@ package-install > (package--archives-initialize) > (list (intern (completing-read > "Install package: " > + (append > (delq nil > (mapcar (lambda (elt) > (unless (package-installed-p (car elt)) > (symbol-name (car elt)))) > package-archive-contents)) > + package--safely-upgradeable-builtins) > nil t)) > nil))) > (package--archives-initialize) > + (when (package--safely-upgradeable-builtin pkg) > + (setq pkg (cadr (assoc pkg package-archive-contents)))) > (add-hook 'post-command-hook #'package-menu--post-refresh) > (let ((name (if (package-desc-p pkg) > (package-desc-name pkg) > diff --git a/lisp/use-package/use-package-ensure.el > b/lisp/use-package/use-package-ensure.el > index e0ea982594e..cfa10f453d9 100644 > --- a/lisp/use-package/use-package-ensure.el > +++ b/lisp/use-package/use-package-ensure.el > @@ -160,7 +160,8 @@ use-package-ensure-elpa > (when (consp package) > (use-package-pin-package (car package) (cdr package)) > (setq package (car package))) > - (unless (package-installed-p package) > + (when (or (package--safely-upgradeable-builtin package) > + (not (package-installed-p package))) > (condition-case-unless-debug err > (progn > (when (assoc package (bound-and-true-p