git: 40b58e3183ac - stable/13 - pkg: improve error message

From: Ed Maste <emaste_at_FreeBSD.org>
Date: Fri, 11 Oct 2024 16:18:31 UTC
The branch stable/13 has been updated by emaste:

URL: https://cgit.FreeBSD.org/src/commit/?id=40b58e3183ac23dbb14d1be2c35dcef7efb6111d

commit 40b58e3183ac23dbb14d1be2c35dcef7efb6111d
Author:     Ed Maste <emaste@FreeBSD.org>
AuthorDate: 2024-10-07 16:33:12 +0000
Commit:     Ed Maste <emaste@FreeBSD.org>
CommitDate: 2024-10-11 16:17:56 +0000

    pkg: improve error message
    
    Print the complete list of url that have failed
    
    PR:             281924
    Co-authored-by: Baptiste Daroussin <bapt@FreeBSD.org>
    Differential Revision: https://reviews.freebsd.org/D46983
    
    (cherry picked from commit be9243409d6be99f5d7815b6d074a85a6e84f7ce)
    (cherry picked from commit 2f29060f46138bbfc52c5944825293d598cc68de)
---
 usr.sbin/pkg/pkg.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/usr.sbin/pkg/pkg.c b/usr.sbin/pkg/pkg.c
index 7867b89e07d4..1915893af283 100644
--- a/usr.sbin/pkg/pkg.c
+++ b/usr.sbin/pkg/pkg.c
@@ -854,7 +854,11 @@ bootstrap_pkg(bool force, const char *fetchOpts)
 	goto cleanup;
 
 fetchfail:
-	warnx("Error fetching %s: %s", url, fetchLastErrString);
+	for (int j = 0; bootstrap_names[j] != NULL; j++) {
+		warnx("Attempted to fetch %s/Latest/%s", packagesite,
+		    bootstrap_names[j]);
+	}
+	warnx("Error: %s", fetchLastErrString);
 	if (fetchLastErrCode == FETCH_RESOLV) {
 		fprintf(stderr, "Address resolution failed for %s.\n", packagesite);
 		fprintf(stderr, "Consider changing PACKAGESITE.\n");