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:13:00 +0000 Message-ID: <87bjwytis3.fsf@posteo.net> References: <4361fa59c17dc06b285fea25f025a9e86f81d1fe.camel@yandex.ru> <867c7mzuva.fsf@gnu.org> 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="4910"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 75065@debbugs.gnu.org, Stefan Monnier , Konstantin Kharlamov To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Dec 26 19:14:36 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 1tQsNX-00016P-R4 for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 26 Dec 2024 19:14:36 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tQsN4-0001iy-4z; Thu, 26 Dec 2024 13:14:06 -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 1tQsN1-0001ij-F7 for bug-gnu-emacs@gnu.org; Thu, 26 Dec 2024 13:14: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 1tQsN1-0008Cs-6d for bug-gnu-emacs@gnu.org; Thu, 26 Dec 2024 13:14:03 -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=NwPYKb1+/1szr/1iw1m7+PdZ/+9pwhZEV+PR/12LJn4=; b=ouBR52iaB9qeTlH7PlLp0BBaFkBBnxx8DO5wz2GrgJaq2aLXzmkTE5lTC94XsDlrhnY54DPxJx2GMvxktjnp8y35bHmskWtMOUYylN+HSynij2IK2DeponwOhSXMRBWwUob/pzwyF08wayvGAwqhe4tfo6RpoFhBWNR0ij/IEwbxVHeVxN3B1dBEfvDaSmgv0xsfW6Rw9FBIGF9F2iIa4rTVX/uKYvmXQ/rz3hCy2WTSSLOIXgPya/B+a3rzOUat/zSF0dNvQNT2DrPxYcGjEf7KXlMNU4tIbuPCZK/ckSocEsxA/ZtvGJ8l9aTWjIdOpIUO3ZPIOhqCvM0ZhRfGYw==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tQsN0-0002dC-0f for bug-gnu-emacs@gnu.org; Thu, 26 Dec 2024 13:14: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:14: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.173523679510045 (code B ref 75065); Thu, 26 Dec 2024 18:14:01 +0000 Original-Received: (at 75065) by debbugs.gnu.org; 26 Dec 2024 18:13:15 +0000 Original-Received: from localhost ([127.0.0.1]:42142 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tQsME-0002bx-Lr for submit@debbugs.gnu.org; Thu, 26 Dec 2024 13:13:15 -0500 Original-Received: from mout01.posteo.de ([185.67.36.65]:35495) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tQsMA-0002bh-DB for 75065@debbugs.gnu.org; Thu, 26 Dec 2024 13:13:13 -0500 Original-Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id 2DBEA240027 for <75065@debbugs.gnu.org>; Thu, 26 Dec 2024 19:13:02 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1735236784; bh=T1nd1mHdGmrRiTIzbzle4Q2VtsaBco9oONGT+Z29+K0=; h=From:To:Cc:Subject:Autocrypt:OpenPGP:Date:Message-ID:MIME-Version: Content-Type:Content-Transfer-Encoding:From; b=VCATvstv65fSg1LdbZs34qEshseeOHg9tRbH48gKLV/7a3DrB3xWvOt1WKqxOX7rC 9jr7jpsA2ujhQPE6C4WwkNfiPFULNLg9qtDjNKbXOrvCqlZ0dYxC70yPnEuec9SN/j RI3VlLP4Y7qYvYDXFDumLqvnnNNBZmINal6lcj7rza7qJG2qIjeanbOWK1BeWk1ALI sbeXSx5lYa5fsVdTxGae6gBPEsMNM1tNaPkjyLRYgETA/L8k3gGexpjZMfzB1yN63M hkH1CPDAbubuTUwaEdp62ajBdaf44f52LItwEhn5KQDGQcq02HHCGqV+IxCbOboylv OYy8fkmtR5Frg== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4YJxZ50jrWz6tvk; Thu, 26 Dec 2024 19:13:00 +0100 (CET) In-Reply-To: <867c7mzuva.fsf@gnu.org> (Eli Zaretskii's message of "Thu, 26 Dec 2024 10:55:21 +0200") 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:297775 Archived-At: Eli Zaretskii writes: >> 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-deadgrep-f= ron-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. >> --- >> lisp/emacs-lisp/package.el | 6 +++--- >> 1 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 res= ult. >> If optional argument ASYNC is non-nil, perform the downloads >> asynchronously." >> (dolist (archive package-archives) >> - (condition-case-unless-debug nil >> + (condition-case-unless-debug err >> (package--download-one-archive archive "archive-contents" async) >> - (error (message "Failed to download `%s' archive." >> - (car archive)))))) >> + (error (message "Failed to download `%s' archive. Error: %S" >> + (car archive) (cdr err)))))) >>=20=20 >> (defvar package-refresh-contents-hook (list #'package--download-and-rea= d-archives) >> "List of functions to call to refresh the package archive. >> --=20 >> 2.47.1 > > Thanks. > > Stefan and Philip, is this okay to install? It seems harmless, I am just uncertain if we should prefer %S or %s to format the error message.