From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#75065: Upon archive download failure print the original error Date: Fri, 27 Dec 2024 12:01:14 -0500 Message-ID: References: <4361fa59c17dc06b285fea25f025a9e86f81d1fe.camel@yandex.ru> <867c7mzuva.fsf@gnu.org> <87bjwytis3.fsf@posteo.net> Reply-To: Stefan Monnier 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="27859"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 75065-done@debbugs.gnu.org, Eli Zaretskii , Konstantin Kharlamov To: Philip Kaludercic Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Dec 27 18:03:08 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 1tRDjv-00071t-Ep for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 27 Dec 2024 18:03:07 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tRDjl-0008OV-8W; Fri, 27 Dec 2024 12:02:59 -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 1tRDit-0007zE-2j for bug-gnu-emacs@gnu.org; Fri, 27 Dec 2024 12:02:12 -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 1tRDis-0003ty-3W for bug-gnu-emacs@gnu.org; Fri, 27 Dec 2024 12:02: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=zEN3EqqxGFK8AFz7goz7rjdqCE9UZHdS/TJdlDKK0Y4=; b=MhUXSwbRLR4RqX97Ikpc0W2xY7cLdwg9uAHOLE8RGEDPkd95OWTSq9/dukLRZubqbNYu9lQtbqzyhc/R9+wdgoax2+5awTy8Woq5tiNZo/2IafzJ9kDyFfCA3KiKT66q7qj+UklU3Wiwn8GuvQ7C0014+kfngA+7nifPSsMuZ/GemZt+ZLVpC6p5JYdeYblg/Ytycr7x1rPXkDTviawTRtm/vFJ1FfCebtS8A7Ls2HveQjMdIwt5XsgTmyQsUR/EBCt+/lzk+lS0xWU0XZBJ66v14nrPQ3t6gOC24E1Wb++FeAdwFIyR7qa2RSYmN8B9DfP+eTsJXRXlQ+j+qJqRsA==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tRDir-0003xd-Uq for bug-gnu-emacs@gnu.org; Fri, 27 Dec 2024 12:02:01 -0500 Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-To: bug-gnu-emacs@gnu.org Resent-Date: Fri, 27 Dec 2024 17:02:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: cc-closed 75065 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Mail-Followup-To: 75065@debbugs.gnu.org, monnier@iro.umontreal.ca, Hi-Angel@yandex.ru Original-Received: via spool by 75065-done@debbugs.gnu.org id=D75065.173531888615158 (code D ref 75065); Fri, 27 Dec 2024 17:02:01 +0000 Original-Received: (at 75065-done) by debbugs.gnu.org; 27 Dec 2024 17:01:26 +0000 Original-Received: from localhost ([127.0.0.1]:47388 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tRDiH-0003wP-Q4 for submit@debbugs.gnu.org; Fri, 27 Dec 2024 12:01:26 -0500 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:62671) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tRDiF-0003w4-E2 for 75065-done@debbugs.gnu.org; Fri, 27 Dec 2024 12:01:23 -0500 Original-Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id C3DAF100043; Fri, 27 Dec 2024 12:01:16 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1735318876; bh=q0ZwJbndcIoo+uSWd1Foy6HFwpgAfGbRDxpMht7cqpE=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=n8+3rvte0M/HLJ6sBcpa80o9deUGOmh+A+LGbiRN5FY5O/rrgVYgF+miQ8eyVuSOe pkgqke1/uH2rsCChMOJ+Kk/++i5VpftPAYE1oz7oxNM0IKZeiRxee0OHo1v8KUttut Y7d3zuUluzE6zKU5FdZnYXBzsJ2Txpk9Zo/6gF/zrFztz9JLVkTOPu8DI5esJp/4Jj Y+bp8NENp5zYNkK7ssT+rrBKLBD5S7mulO4z+8loQZ8C4sncZqPaZAP5PVth5kn2lu T+qQgDsHm5oHbTDrYcuu2Xp0cv+2fx91m4yxrJ73Rpjx2/z5cuqEeh9dqdlJI24lmU ATQmKZxfyMgAA== Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 0F15F10002E; Fri, 27 Dec 2024 12:01:16 -0500 (EST) Original-Received: from asado (unknown [23.233.149.155]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id DBFDF120568; Fri, 27 Dec 2024 12:01:15 -0500 (EST) In-Reply-To: (Stefan Monnier's message of "Thu, 26 Dec 2024 14:17:46 -0500") 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:297835 Archived-At: --=-=-= Content-Type: text/plain > `%s` to print `err` or `(cdr err)` would be wrong, since `%s` is for use > with strings rather than lists. IOW, IMO, it should be either > > ...%S" ... err) > > or > > ...%s" ... (error-message-string err)) > > where the first is a bit more "debugging/developer" friendly and the second > is a bit more "user" friendly. Revising the code of `package.el` I see that those errors&messages are meant to be exposed to the user, so they should preferably use `error-message-string`. So I installed the patch below into `master`. Thank you! Closing, Stefan --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=package.patch commit a99e1cc745047977b0b7cbd25fe9df66e9c86a39 Author: Stefan Monnier Date: Fri Dec 27 11:58:30 2024 -0500 (package--download-and-read-archives): Fix bug#75065 * lisp/emacs-lisp/package.el (package--download-and-read-archives): Include the error info in the error message. Suggested by Konstantin Kharlamov . (package-refresh-contents, package-menu--perform-transaction): Use `error-message-string`. diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index 5f785071ea3..bff45d57b07 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -1829,10 +1829,11 @@ package--download-and-read-archives 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: %s" + (car archive) + (error-message-string err)))))) (defvar package-refresh-contents-hook (list #'package--download-and-read-archives) "List of functions to call to refresh the package archive. @@ -1856,7 +1857,8 @@ package-refresh-contents (when (and (package-check-signature) (file-exists-p default-keyring)) (condition-case-unless-debug error (package-import-keyring default-keyring) - (error (message "Cannot import default keyring: %S" (cdr error)))))) + (error (message "Cannot import default keyring: %s" + (error-message-string error)))))) (run-hook-with-args 'package-refresh-contents-hook async)) @@ -3989,8 +3991,9 @@ package-menu--perform-transaction (package-delete elt nil 'nosave)) (error (push (package-desc-full-name elt) errors) - (message "Error trying to delete `%s': %S" - (package-desc-full-name elt) err))))) + (message "Error trying to delete `%s': %s" + (package-desc-full-name elt) + (error-message-string err)))))) errors)) (defun package--update-selected-packages (add remove) --=-=-=--