Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 6 Aug 2020 04:52:30 +0000 (UTC)
From:      Kyle Evans <kevans@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: r363940 - stable/12/usr.sbin/pkg
Message-ID:  <202008060452.0764qUcF031462@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kevans
Date: Thu Aug  6 04:52:30 2020
New Revision: 363940
URL: https://svnweb.freebsd.org/changeset/base/363940

Log:
  MFC r363421: pkg-bootstrap: complain on improper `pkg bootstrap` usage
  
  Right now, the bootstrap will gloss over things like pkg bootstrap -x or
  pkg bootstrap -f pkg. Make it more clear that this is incorrect, and hint
  at the correct formatting.

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	Thu Aug  6 04:20:14 2020	(r363939)
+++ stable/12/usr.sbin/pkg/pkg.c	Thu Aug  6 04:52:30 2020	(r363940)
@@ -1050,8 +1050,16 @@ main(int argc, char *argv[])
 
 	if (argc > 1 && strcmp(argv[1], "bootstrap") == 0) {
 		bootstrap_only = true;
-		if (argc == 3 && strcmp(argv[2], "-f") == 0)
+		if (argc > 3) {
+			fprintf(stderr, "Too many arguments\nUsage: pkg bootstrap [-f]\n");
+			exit(EXIT_FAILURE);
+		}
+		if (argc == 3 && strcmp(argv[2], "-f") == 0) {
 			force = true;
+		} else if (argc == 3) {
+			fprintf(stderr, "Invalid argument specified\nUsage: pkg bootstrap [-f]\n");
+			exit(EXIT_FAILURE);
+		}
 	}
 
 	if ((bootstrap_only && force) || access(pkgpath, X_OK) == -1) {



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