From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Konstantin Kharlamov Newsgroups: gmane.emacs.bugs Subject: bug#75065: Upon archive download failure print the original error Date: Thu, 26 Dec 2024 21:17:00 +0300 Message-ID: <737bc5fd466e36c1a52753d0ce429ad57086c37d.camel@yandex.ru> References: <4361fa59c17dc06b285fea25f025a9e86f81d1fe.camel@yandex.ru> <867c7mzuva.fsf@gnu.org> <87bjwytis3.fsf@posteo.net> 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="19320"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Evolution 3.54.2 Cc: 75065@debbugs.gnu.org, Stefan Monnier To: Philip Kaludercic , Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Dec 26 19:18:30 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 1tQsRJ-0004ui-Vh for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 26 Dec 2024 19:18:30 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tQsQz-0002kv-S4; Thu, 26 Dec 2024 13:18:11 -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 1tQsQt-0002kW-VR for bug-gnu-emacs@gnu.org; Thu, 26 Dec 2024 13:18: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 1tQsQs-0000DT-3I for bug-gnu-emacs@gnu.org; Thu, 26 Dec 2024 13:18: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:References:In-Reply-To:Date:From:To:Subject; bh=rseET+L0SpaMPN4jNMgCKHspF/BBq7d5KmcIt7vzaCI=; b=jmp0SH+bBJFWWqsa6L7mgjIM0rlbETQFLqgb/DaGKQcQiHkqGonTPXSKx2tpK3KbkdTdytFJQwup4IxaTUEAud0DzzMgnrKyN6cYMERfEUTwqsrirCaPBAhUBK27LkYzGFF2je3rg3oLy9HYOajs33CDPNfv1rX6ipfp0Kspz0Fw6YWcmhhw/8MTDbLXD0Rrk+2b+1iLTzRMPMQ06+6hLzCVhvE5WIVFz/s2LlsazViWOfPEeG+dgVjhAOSRIsvYfz5UMDy9ftp81p7GaF9+Y0C7bqzqGFpN6iyH9r/PGIJbQZD3dK3ELKEUMtS04Yl/OwfytA21AyQ9M4yPKz7y7A==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tQsQr-0002pA-U2 for bug-gnu-emacs@gnu.org; Thu, 26 Dec 2024 13:18:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Konstantin Kharlamov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 26 Dec 2024 18:18: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.173523704310810 (code B ref 75065); Thu, 26 Dec 2024 18:18:01 +0000 Original-Received: (at 75065) by debbugs.gnu.org; 26 Dec 2024 18:17:23 +0000 Original-Received: from localhost ([127.0.0.1]:42150 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tQsQE-0002oH-Fq for submit@debbugs.gnu.org; Thu, 26 Dec 2024 13:17:22 -0500 Original-Received: from forward502d.mail.yandex.net ([178.154.239.210]:33146) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tQsQB-0002o2-G0 for 75065@debbugs.gnu.org; Thu, 26 Dec 2024 13:17:20 -0500 Original-Received: from mail-nwsmtp-smtp-production-main-42.klg.yp-c.yandex.net (mail-nwsmtp-smtp-production-main-42.klg.yp-c.yandex.net [IPv6:2a02:6b8:c42:55a0:0:640:1286:0]) by forward502d.mail.yandex.net (Yandex) with ESMTPS id E98776151A; Thu, 26 Dec 2024 21:17:02 +0300 (MSK) Original-Received: by mail-nwsmtp-smtp-production-main-42.klg.yp-c.yandex.net (smtp/Yandex) with ESMTPSA id 0HeYaCXOjKo0-ebig3Ftt; Thu, 26 Dec 2024 21:17:02 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1735237022; bh=rseET+L0SpaMPN4jNMgCKHspF/BBq7d5KmcIt7vzaCI=; h=References:Date:In-Reply-To:Cc:To:From:Subject:Message-ID; b=VkKeQUgFvO6HcYl4fzq4DPtRew23xIez1Vw9CFl+aH1nrXM2hySuNzanYCiI+hQZY 0C0Eajx8W8zJUgm5LMlqU/Abuqv0Mvm6hgrGHWNSzO35Q142SQEXISxiLOJ9GHqV4L 7BheeArtsvj7VaIDcBOwlyPp5YgW9FZt+DJA6ZPw= Authentication-Results: mail-nwsmtp-smtp-production-main-42.klg.yp-c.yandex.net; dkim=pass header.i=@yandex.ru In-Reply-To: <87bjwytis3.fsf@posteo.net> 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:297776 Archived-At: 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-deadgre= p-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-o= ne-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--download= - > > > and-read-archives) > > > =C2=A0=C2=A0 "List of functions to call to refresh the package archiv= e. > > > --=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 go= es 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.