summaryrefslogtreecommitdiff
path: root/usr.sbin/pkg_add
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2023-07-20 17:56:38 +0000
committerMarc Espie <espie@cvs.openbsd.org>2023-07-20 17:56:38 +0000
commit804c2ac770f0f2fc88554174471c3b65dfce291d (patch)
treeeaecf95d7450ae0a48cfb6eb65728d1a20c25679 /usr.sbin/pkg_add
parent8cd7c2f96fbf9e956c9bfcd819177d029e4c2e89 (diff)
fix esoteric error message in case PackageName parses stuff to a bogus
fullpkgname, as seen by Matthias Schmidt
Diffstat (limited to 'usr.sbin/pkg_add')
-rw-r--r--usr.sbin/pkg_add/OpenBSD/PkgCreate.pm10
1 files changed, 9 insertions, 1 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/PkgCreate.pm b/usr.sbin/pkg_add/OpenBSD/PkgCreate.pm
index 8c2ddca65a3..4ce2a45851a 100644
--- a/usr.sbin/pkg_add/OpenBSD/PkgCreate.pm
+++ b/usr.sbin/pkg_add/OpenBSD/PkgCreate.pm
@@ -1,6 +1,6 @@
#! /usr/bin/perl
# ex:ts=8 sw=4:
-# $OpenBSD: PkgCreate.pm,v 1.194 2023/07/04 14:03:16 espie Exp $
+# $OpenBSD: PkgCreate.pm,v 1.195 2023/07/20 17:56:37 espie Exp $
#
# Copyright (c) 2003-2014 Marc Espie <espie@openbsd.org>
#
@@ -1571,6 +1571,14 @@ sub validate_pkgname($self, $state, $pkgname)
}
my $okay_flavors = {map {($_, 1)} split(/\s+/, $flavor_list) };
my $v = OpenBSD::PackageName->from_string($pkgname);
+
+ # first check we got a non buggy pkgname, since otherwise
+ # the parts we test won't even exist !
+ if ($v->has_issues) {
+ $state->errsay("Error FULLPKGNAME #1 #2", $pkgname,
+ $v->has_issues);
+ $state->fatal("Can't continue");
+ }
my $errors = 0;
if ($v->{version}->p != $revision) {
$state->errsay("REVISION mismatch (REVISION=#1)", $revision);