From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#75065: Upon archive download failure print the original error Date: Thu, 26 Dec 2024 10:55:21 +0200 Message-ID: <867c7mzuva.fsf@gnu.org> References: <4361fa59c17dc06b285fea25f025a9e86f81d1fe.camel@yandex.ru> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="8463"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 75065@debbugs.gnu.org To: Konstantin Kharlamov , Philip Kaludercic , Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Dec 26 09:56:14 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 1tQjfC-00020v-0f for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 26 Dec 2024 09:56:14 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tQjf1-0002ZH-Jc; Thu, 26 Dec 2024 03:56:03 -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 1tQjf0-0002Z7-M7 for bug-gnu-emacs@gnu.org; Thu, 26 Dec 2024 03:56:02 -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 1tQjf0-0003ng-Dv for bug-gnu-emacs@gnu.org; Thu, 26 Dec 2024 03:56: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:References:In-Reply-To:From:Date:To:Subject; bh=Hq3ZP9U+6zSph9DFpegcYLfOOdkWaCS4Tet+Zb35Ae8=; b=liDYSPrFwnI36r/oXvwD6gKs74b//Jf5S9oXDZhOTIK5J5NoGYczglDdOixU+HMmDhY5tJ0pAHXXCEc6DPezU50Tip18KKvZPpfvYOk2gFn9nXDUuOR5UtGXkRE9XA3CvcCzQISe3KJAZhCzBgCd5BJUFaW2j/HnyyN8hxsH/sA8JBeq9nOSspnoJt8k8894y46uavMsm5+hInASMLfgwNCv47HeW2GhIa3Uy+1pfdt4qd9CgDYvALYBjYSFcp6hbK3I2EPBWHUhkvkOw+2ipYXaVKKx67QNMGD7LEoijS0feAOZsqJ44fULOtsHzo7D+dJO5ReSKsXtr0+632uF3g==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tQjf0-0001wk-1y for bug-gnu-emacs@gnu.org; Thu, 26 Dec 2024 03:56:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 26 Dec 2024 08:56:02 +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.17352033347428 (code B ref 75065); Thu, 26 Dec 2024 08:56:02 +0000 Original-Received: (at 75065) by debbugs.gnu.org; 26 Dec 2024 08:55:34 +0000 Original-Received: from localhost ([127.0.0.1]:40048 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tQjeX-0001vj-G1 for submit@debbugs.gnu.org; Thu, 26 Dec 2024 03:55:33 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:59508) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tQjeW-0001vK-4A for 75065@debbugs.gnu.org; Thu, 26 Dec 2024 03:55:32 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tQjeQ-0003kH-1L; Thu, 26 Dec 2024 03:55:26 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=Hq3ZP9U+6zSph9DFpegcYLfOOdkWaCS4Tet+Zb35Ae8=; b=hojD+RbDUusBBkySesw0 zhY81fiAwz0hzD0lir7MBlcM/xr0C8S9j7kid4Qr92Raeqq+T81tpL9aOtEe9TNhsH0vVWG3vaoR0 3l5Om6GcPD1jt+sW4X6PDhIfyXVSqJfgFY8+LCKohFYycf8Xeg4NjakfFCmFw+4dSAgk7ROCDXIzX bH84tjk63XKROYKvZa5Ps06MXHqj1A2r8l7BONq02D5uN1vX9Kbo8n++/dpgINUA5tZOvjGzwWKMy anLKfKaoJbDzx2kbKy8MxGguj1LQQMXzcqQ4bKJ5zzfJwUKXSznn6mPXVREFDHbFjSfHQp2S/ohaE bJ6DqfGa4i0f5w==; In-Reply-To: <4361fa59c17dc06b285fea25f025a9e86f81d1fe.camel@yandex.ru> (message from Konstantin Kharlamov on Tue, 24 Dec 2024 18:25:30 +0300) 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:297758 Archived-At: > From: Konstantin Kharlamov > Date: Tue, 24 Dec 2024 18:25:30 +0300 > > I was recently helping out a new Emacs user with package installation¹, > 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. > > That happens because (package--download-and-read-archives) ignores the > exception message, and always just prints generic failure message. > > This code fixes this, so now the actual failure message will be > correctly shown. > > 1: > https://emacs.stackexchange.com/questions/82828/is-installing-deadgrep-fron-melpa-still-possible/82829#82829 > > > 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 > > * 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(-) > > 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. > 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)))))) > > (defvar package-refresh-contents-hook (list #'package--download-and-read-archives) > "List of functions to call to refresh the package archive. > -- > 2.47.1 Thanks. Stefan and Philip, is this okay to install?