abuild: stricter pkgname check

This commit is contained in:
Sertonix 2024-03-22 11:48:28 +01:00 committed by Natanael Copa
parent 73cc75b3e0
commit a9053617db
2 changed files with 11 additions and 3 deletions

View File

@ -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
}

View File

@ -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() {