From a9053617dbd895e36cbc231ded21f0eebc233cda Mon Sep 17 00:00:00 2001 From: Sertonix Date: Fri, 22 Mar 2024 11:48:28 +0100 Subject: [PATCH] abuild: stricter pkgname check --- abuild.in | 5 ++--- tests/abuild_test | 9 +++++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/abuild.in b/abuild.in index 95801fb..d075f52 100644 --- a/abuild.in +++ b/abuild.in @@ -180,9 +180,8 @@ spell_error() { } verify_pkgname() { - local name=${1%%=*} - case "$name" in - ""|*" "*|-*) return 1;; + case $1 in + ''|*[!a-zA-Z0-9._+-]*|[!a-zA-Z0-9]*) return 1;; esac return 0 } diff --git a/tests/abuild_test b/tests/abuild_test index c6d9ea2..d3847bf 100755 --- a/tests/abuild_test +++ b/tests/abuild_test @@ -415,6 +415,9 @@ abuild_valid_pkgnames_body() { TESTSUBNAME=foo atf_check -s exit:0 \ -e match:"Checking sanity" \ abuild sanitycheck + TESTNAME="more_+-2.0-complicated" atf_check -s exit:0 \ + -e match:"Checking sanity" \ + abuild sanitycheck } abuild_invalid_pkgnames_body() { @@ -430,6 +433,12 @@ abuild_invalid_pkgnames_body() { TESTNAME="foo with spaces" atf_check -s exit:1 \ -e match:"Checking sanity" \ abuild sanitycheck + TESTNAME="width@at" atf_check -s exit:1 \ + -e match:"Checking sanity" \ + abuild sanitycheck + TESTNAME="width=equal" atf_check -s exit:1 \ + -e match:"Checking sanity" \ + abuild sanitycheck } abuild_invalid_subpkgnames_body() {