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#75065: Upon archive download failure print the original error Date: Thu, 26 Dec 2024 18:31:41 +0000 Message-ID: <877c7mthwy.fsf@posteo.net> References: <4361fa59c17dc06b285fea25f025a9e86f81d1fe.camel@yandex.ru> <867c7mzuva.fsf@gnu.org> <87bjwytis3.fsf@posteo.net> <737bc5fd466e36c1a52753d0ce429ad57086c37d.camel@yandex.ru> 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="33079"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 75065@debbugs.gnu.org, Eli Zaretskii , Stefan Monnier To: Konstantin Kharlamov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Dec 26 19:32:22 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 1tQsej-0008SV-Ln for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 26 Dec 2024 19:32:21 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tQseT-0004uy-Dx; Thu, 26 Dec 2024 13:32:05 -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 1tQseQ-0004uL-Ox for bug-gnu-emacs@gnu.org; Thu, 26 Dec 2024 13:32: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 1tQseQ-0001VM-FY for bug-gnu-emacs@gnu.org; Thu, 26 Dec 2024 13:32: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=3AViChcXMsPOkQkKYkrPvnEciUC63NecxxCvx69xXTU=; b=AOONiBoFsvkeV6jkTbJZ/w7L4Y2YJ4Skg2yahTCbVJgIUqzpMaaN0H7Z44R9/dCKFrGW8xbKymHikIB50WLO1m5l6zE8Df2lfqIfBO+5dvXhbdSU25Z0Oa7gzTGjes0jayK94segsFGMQah56kqSYtWTtjmBtsxHN/dwDFG6bl0/YX4Si0FWr6kgFgs4YKNpYgMCeOpn+REAomgiFlg1Wcumw4dZFRc8ZXOL6eL/V4TkEWMFZBt/OZbnKBNqFQkvfbKTywDA6tQCRSR3EUmvyqPRxByzSMNhLa+pQnQBMJbF4hEqeBVM+Soy/OTyPNSDo9cRbWRTshaSl2Sw5nn0eg==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tQseQ-0003Si-0R for bug-gnu-emacs@gnu.org; Thu, 26 Dec 2024 13:32:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Philip Kaludercic Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 26 Dec 2024 18:32:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 75065 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 75065-submit@debbugs.gnu.org id=B75065.173523791413293 (code B ref 75065); Thu, 26 Dec 2024 18:32:01 +0000 Original-Received: (at 75065) by debbugs.gnu.org; 26 Dec 2024 18:31:54 +0000 Original-Received: from localhost ([127.0.0.1]:42173 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tQseH-0003SK-BN for submit@debbugs.gnu.org; Thu, 26 Dec 2024 13:31:53 -0500 Original-Received: from mout01.posteo.de ([185.67.36.65]:48841) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tQseD-0003S4-Qa for 75065@debbugs.gnu.org; Thu, 26 Dec 2024 13:31:52 -0500 Original-Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id 19BD5240027 for <75065@debbugs.gnu.org>; Thu, 26 Dec 2024 19:31:42 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1735237903; bh=3AViChcXMsPOkQkKYkrPvnEciUC63NecxxCvx69xXTU=; h=From:To:Cc:Subject:Autocrypt:OpenPGP:Date:Message-ID:MIME-Version: Content-Type:Content-Transfer-Encoding:From; b=DTaF47Ktrjhizgg7KTEgXgX7Qi74n3IoC7hu/uE79ZUgUHlv5suGmBAYiROywg42h 104DFsEbtlF4KXCGTHScXXzFg5xKv9m2c4gFt7Vb/Lp0WVekHXMtQH7LVTUVlBMXxw TWcA2T27aLfh2XSrAYUauSavfH9uc9hP1AYfMOPKUaIYj4PTWm2XE6cZYb1vo6fJq3 xJZja6s/MO3emfXarRPRjqgYUIbc58QwDHKcr2DLm0X8tK/YNxdZqHDwTC0VIyipN0 /iFzID6YPMdYD7GIjt0ZPdN+pr4+4allXZU5Dn5LAzaMBxaI1aWmwQuBHduQ5cHsVo BDU1xMvSVIBZw== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4YJxzd5PYdz6ty6; Thu, 26 Dec 2024 19:31:41 +0100 (CET) In-Reply-To: <737bc5fd466e36c1a52753d0ce429ad57086c37d.camel@yandex.ru> (Konstantin Kharlamov's message of "Thu, 26 Dec 2024 21:17:00 +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 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:297777 Archived-At: Konstantin Kharlamov writes: > On Thu, 2024-12-26 at 18:13 +0000, Philip Kaludercic wrote: >> Eli Zaretskii writes: >>=20 >> > > From: Konstantin Kharlamov >> > > Date: Tue, 24 Dec 2024 18:25:30 +0300 >> > >=20 >> > > I was recently helping out a new Emacs user with package >> > > installation=C2=B9, >> > > and I found an interesting thing: if you put to `package- >> > > archives` a >> > > URL without `https` prefix, download will fail. Long story short, >> > > the >> > > reason turns out that `package-archives` also supports local >> > > paths, >> > > which the URL being considered as. However, Emacs never prints a >> > > message about that, even though such message exists in the code. >> > > Instead it just says that download failed, leaving a user >> > > wondering >> > > why. >> > >=20 >> > > That happens because (package--download-and-read-archives) >> > > ignores the >> > > exception message, and always just prints generic failure >> > > message. >> > >=20 >> > > This code fixes this, so now the actual failure message will be >> > > correctly shown. >> > >=20 >> > > 1: >> > > https://emacs.stackexchange.com/questions/82828/is-installing-deadgr= ep-fron-melpa-still-possible/82829#82829 >> > >=20 >> > >=20 >> > > From fb4685238726a79599f6388318916d2962da93ae Mon Sep 17 00:00:00 >> > > 2001 >> > > From: Konstantin Kharlamov >> > > Date: Tue, 24 Dec 2024 18:16:41 +0300 >> > > Subject: [PATCH] Upon archive download failure print the original >> > > error >> > >=20 >> > > * lisp/emacs-lisp/package.el (package--download-and-read- >> > > archives): >> > > upon catching exception, use the exception message as part of the >> > > error to provide more context about the failure. >> > > --- >> > > =C2=A0lisp/emacs-lisp/package.el | 6 +++--- >> > > =C2=A01 file changed, 3 insertions(+), 3 deletions(-) >> > >=20 >> > > diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs- >> > > lisp/package.el >> > > index 5f785071ea3..cb81efc71f0 100644 >> > > --- a/lisp/emacs-lisp/package.el >> > > +++ b/lisp/emacs-lisp/package.el >> > > @@ -1829,10 +1829,10 @@ Populate `package-archive-contents' with >> > > the result. >> > > =C2=A0If optional argument ASYNC is non-nil, perform the downloads >> > > =C2=A0asynchronously." >> > > =C2=A0=C2=A0 (dolist (archive package-archives) >> > > -=C2=A0=C2=A0=C2=A0 (condition-case-unless-debug nil >> > > +=C2=A0=C2=A0=C2=A0 (condition-case-unless-debug err >> > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (package--download-= one-archive archive "archive- >> > > contents" async) >> > > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (error (message "Failed to download = `%s' archive." >> > > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 (car archive)))))) >> > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (error (message "Failed to download = `%s' archive. Error: >> > > %S" >> > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 (car archive) (cdr err)))))) >> > > =C2=A0 >> > > =C2=A0(defvar package-refresh-contents-hook (list #'package--downloa= d- >> > > and-read-archives) >> > > =C2=A0=C2=A0 "List of functions to call to refresh the package archi= ve. >> > > --=20 >> > > 2.47.1 >> >=20 >> > Thanks. >> >=20 >> > Stefan and Philip, is this okay to install? >>=20 >> It seems harmless, I am just uncertain if we should prefer %S or %s >> to >> format the error message. > > The reason I used %S is that 2x lines below there's similar > construction with (error =E2=80=A6) and it's using %S, so the usage here = goes > in line with the other code. > > That said, I have no preference, I can change it to %s, even in both > locations if you want. In that case I think %S is preferable, and the patch is fine with me.