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#74556: 30.0.92; Package upgrade can fail and results in deleted package Date: Tue, 10 Dec 2024 20:12:15 +0000 Message-ID: <87ldwnxppc.fsf@posteo.net> References: <87plmgq55e.fsf@daniel-mendler.de> <87zflj62ai.fsf@posteo.net> <87v7w7617o.fsf@posteo.net> <86ttbfism4.fsf@gnu.org> <87v7vvz0ay.fsf@posteo.net> <87zfl3h93m.fsf@daniel-mendler.de> 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="18860"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Eli Zaretskii , 74556@debbugs.gnu.org To: Daniel Mendler Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Dec 10 21:13:25 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 1tL6bk-0004iZ-0h for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 10 Dec 2024 21:13:24 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tL6bU-0001uO-VA; Tue, 10 Dec 2024 15:13:09 -0500 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 1tL6bO-0001u3-NY for bug-gnu-emacs@gnu.org; Tue, 10 Dec 2024 15:13:03 -0500 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 1tL6bO-0007GU-Ab for bug-gnu-emacs@gnu.org; Tue, 10 Dec 2024 15:13:02 -0500 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=WjKIHo/L/HEPpVBsO7wOqaY/GD/nGxrtuQ0PNbrdkks=; b=asp1TH/K91arpYzgqAsP4TEyvwu0uqWoozY3YiQ/+iVj4z5+okFUFqcFxzY9Hn/rGEXZvX9V+zujbWObamlpf5xLy+ks6RtrKbDqjhZiKBk+lFcmRudtpOd4SV8w8hzpWY0IWQHToHwnJm5p7MWIxbmKZsKJ8GIU6GjqHO2YI9Yg1lEbzUJzvgqzvpLpRWT1W8C9AWe11cCq4XMs0aNhvsyshoEk6zZnq7Lp+SPWeM/v5EonybQOimUr303MfaR89yoiQMuzcKmqKzVSlvKPAWgvnr5OovxwMouX8PTq/Wu0qOKl8mcwQVznsg+VfMZw99CBrb4Gnmn8AuaUDO/4cg==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tL6bN-0005IC-TD for bug-gnu-emacs@gnu.org; Tue, 10 Dec 2024 15:13:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Philip Kaludercic Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 10 Dec 2024 20:13:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 74556 X-GNU-PR-Package: emacs Original-Received: via spool by 74556-submit@debbugs.gnu.org id=B74556.173386154920261 (code B ref 74556); Tue, 10 Dec 2024 20:13:01 +0000 Original-Received: (at 74556) by debbugs.gnu.org; 10 Dec 2024 20:12:29 +0000 Original-Received: from localhost ([127.0.0.1]:59736 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tL6aq-0005Gg-SM for submit@debbugs.gnu.org; Tue, 10 Dec 2024 15:12:29 -0500 Original-Received: from mout01.posteo.de ([185.67.36.65]:59359) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tL6am-0005GC-RU for 74556@debbugs.gnu.org; Tue, 10 Dec 2024 15:12:27 -0500 Original-Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id 96C8E240029 for <74556@debbugs.gnu.org>; Tue, 10 Dec 2024 21:12:17 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1733861538; bh=tzwvEb36frL4dolbIle1oQYV+MsAYrRDQaoC5ipskjE=; h=From:To:Cc:Subject:Autocrypt:OpenPGP:Date:Message-ID:MIME-Version: Content-Type:From; b=RGQrM5GmrcVxUuiOEsDHDW+b9EcNrkvGR0NjWw17ClTl3ifZ00KWz9yHkjtDBncDB zJHbOJSDN3lE1SvBRpqfVrVOTl5iaEkmYRWYyeOa5yyCp92UPyNWWUaToryHWa+pEa HoChHm9KTKMwOJqb3rQhjZB0+mr9LRH25R8yPfU1JGn6CrkUGRvdsQZdmcFNc18f6z c9oJMeHsB/9FiJYodSncJCO5QNcXMVOUnk1bdNxvVlWwiD6rwXls0Fzhb+r9XQPYn0 Ng3qY/VVZ85oNNwTg2fAjsaCHF2K5ZqLIsWXN6Ss6btTiikmzHY0kW7PspKhybPjzs tFEx1+N9Z3Q+Q== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4Y78z41h6zz6tvk; Tue, 10 Dec 2024 21:12:15 +0100 (CET) In-Reply-To: <87zfl3h93m.fsf@daniel-mendler.de> (Daniel Mendler's message of "Tue, 10 Dec 2024 16:05:17 +0100") 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 OpenPGP: id=7126E1DE2F0CE35C770BED01F2C3CC513DB89F66; url="https://keys.openpgp.org/vks/v1/by-fingerprint/7126E1DE2F0CE35C770BED01F2C3CC513DB89F66"; preference=signencrypt 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:296782 Archived-At: --=-=-= Content-Type: text/plain Daniel Mendler writes: > Philip Kaludercic writes: > >> Eli Zaretskii writes: >> >>>> Cc: 74556@debbugs.gnu.org >>>> From: Philip Kaludercic >>>> Date: Thu, 28 Nov 2024 11:34:51 +0000 >>>> >>>> Philip Kaludercic writes: >>>> >>>> [...] >>>> >>>> > It might make sense to try and "deactivate" a package before installing >>>> > the new package. Looking into some second-try fallback for >>>> > package-install to refresh the package index if a package was not found >>>> > would also be a good idea ^^ >>>> >>>> This might do it? >>> >>> Philip, please install this on the emacs-30 branch, unless you see any >>> problems with the change. We'd like to make another pretest soon. >> >> Done. But we should keep the report open as there might be better >> approaches to discuss in the future. > > Hello Philip, > > I just tried the modified `package-upgrade' function and it doesn't seem > to work. It seems to break the upgrade procedure in an even worse way, > at least in my setup. Now `package-install' is tried first with the > package symbol, which will be a no-op, since the package is already > installed. Afterwards the package is deleted and we always end up with > no package. Probably `package-install' should also be called with a > package descriptor of the new package version? Right, my sincere apologies for that oversight. That being said, I don't feel comfortable fixing this right now as I am short on time to fix and test something like this on the "emacs-30" branch. My vote would be to revert the commit and try to tackle the issue on the "master" branch. An alternative I can propose that would be closer to the original code might be --=-=-= Content-Type: text/plain Content-Disposition: inline diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index fad0762e126..93b647edcea 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -2268,16 +2285,14 @@ package-upgrade ;; `pkg-desc' will be nil when the package is an "active built-in". (if (and pkg-desc (package-vc-p pkg-desc)) (package-vc-upgrade pkg-desc) - (package-install package - ;; An active built-in has never been "selected" - ;; before. Mark it as installed explicitly. - (and pkg-desc 'dont-select)) - ;; We delete the old package via the descriptor after installing - ;; the new package to avoid losing the package if there issues - ;; during installation (Bug#74556). - (when pkg-desc - (cl-assert (package-desc-dir pkg-desc)) - (package-delete pkg-desc 'force 'dont-unselect))))) + (unwind-protect + (when pkg-desc + (cl-assert (package-desc-dir pkg-desc)) + (package-delete pkg-desc 'force 'dont-unselect)) + (package-install package + ;; An active built-in has never been "selected" + ;; before. Mark it as installed explicitly. + (and pkg-desc 'dont-select)))))) (defun package--upgradeable-packages (&optional include-builtins) ;; Initialize the package system to get the list of package --=-=-= Content-Type: text/plain > Thanks! > > Daniel --=-=-=--