From 3be5e12f942e0c7b48a197fc4ebdc898a6332c8e Mon Sep 17 00:00:00 2001 From: espie Date: Thu, 20 Jul 2023 17:56:37 +0000 Subject: [PATCH] fix esoteric error message in case PackageName parses stuff to a bogus fullpkgname, as seen by Matthias Schmidt --- usr.sbin/pkg_add/OpenBSD/PkgCreate.pm | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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 # @@ -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); -- 2.20.1