Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 22 Jul 2020 06:45:24 +0000 (UTC)
From:      Tom Jones <thj@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org
Subject:   svn commit: r363412 - stable/12/usr.sbin/pkg
Message-ID:  <202007220645.06M6jOO5029553@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: thj
Date: Wed Jul 22 06:45:24 2020
New Revision: 363412
URL: https://svnweb.freebsd.org/changeset/base/363412

Log:
  MFC r362541:
  
  pkg: Provide a friendlier message when bootstrap fails due to address resolution
  
  The current message when bootstapping pkg fails for any reason implies that pkg
  is not available. We have the error code from fetch so if bootstrap failed due
  to address resolution say so.
  
  Reviewed by:    bapt, bz
  Approved by:    bz (co-mentor)
  Differential Revision:  https://reviews.freebsd.org/D25323

Modified:
  stable/12/usr.sbin/pkg/pkg.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/usr.sbin/pkg/pkg.c
==============================================================================
--- stable/12/usr.sbin/pkg/pkg.c	Wed Jul 22 02:15:21 2020	(r363411)
+++ stable/12/usr.sbin/pkg/pkg.c	Wed Jul 22 06:45:24 2020	(r363412)
@@ -915,10 +915,15 @@ bootstrap_pkg(bool force)
 
 fetchfail:
 	warnx("Error fetching %s: %s", url, fetchLastErrString);
-	fprintf(stderr, "A pre-built version of pkg could not be found for "
-	    "your system.\n");
-	fprintf(stderr, "Consider changing PACKAGESITE or installing it from "
-	    "ports: 'ports-mgmt/pkg'.\n");
+	if (fetchLastErrCode == FETCH_RESOLV) {
+		fprintf(stderr, "Address resolution failed for %s.\n", packagesite);
+		fprintf(stderr, "Consider changing PACKAGESITE.\n");
+	} else {
+		fprintf(stderr, "A pre-built version of pkg could not be found for "
+		    "your system.\n");
+		fprintf(stderr, "Consider changing PACKAGESITE or installing it from "
+		    "ports: 'ports-mgmt/pkg'.\n");
+	}
 
 cleanup:
 	if (fd_sig != -1) {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202007220645.06M6jOO5029553>