Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
alpine
abuild
Commits
ee13f777
Commit
ee13f777
authored
Dec 02, 2022
by
Natanael Copa
Browse files
abuild: fix check of maintainer address
Also disallow leading and trailing spaces/quotes. fixes
#10080
parent
37e15073
Pipeline
#145564
passed with stage
in 34 seconds
Changes
2
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
abuild.in
View file @
ee13f777
...
...
@@ -969,8 +969,6 @@ git_last_commit_epoch() {
get_maintainer
()
{
if
[
-z
"
$maintainer
"
]
;
then
maintainer
=
$(
awk
-F
': '
'/# *Maintainer/ {print $2}'
"
$APKBUILD
"
)
# remove surrounding whitespace
maintainer
=
$(
echo
"
$maintainer
"
| xargs
)
fi
}
...
...
@@ -981,8 +979,10 @@ check_maintainer() {
else
# try to check for a valid rfc822 address
case
"
$maintainer
"
in
*
[
A-Za-z0-9]
*
\ \<
*
@
*
.
*
\>
)
;;
*
)
return
1
;;
" "
*
|
*
" "
)
error
"'
$maintainer
' has leading or trailing space"
;
return
1
;;
\"
*
|
*
\"
)
error
"'
$maintainer
' has leading or trailing quote"
;
return
1
;;
*
\ \<
*
@
*
.
*
\>
)
;;
*
)
error
"'
$maintainer
' is not a valid rfc822 address"
;
return
1
;;
esac
fi
}
...
...
tests/abuild_test
View file @
ee13f777
...
...
@@ -27,7 +27,8 @@ init_tests \
abuild_package_size_nonzero
\
abuild_amove
\
abuild_doc
\
abuild_dev
abuild_dev
\
abuild_check_maintainer
export
ABUILD_SHAREDIR
=
$(
atf_get_srcdir
)
/..
export
ABUILD_CONF
=
/dev/null
...
...
@@ -673,3 +674,24 @@ abuild_dev_body() {
done
test
-L
pkg/foo-dev/usr/lib/libfoo.so
||
atf_fail
"libfoo.so failed"
}
abuild_check_maintainer_body
()
{
mkdir
-p
foo
&&
cd
foo
for
m
in
"Test User 123 <123example.com>"
\
"foo"
\
"user@example.com"
\
" Leading Space <n@example.com>"
\
"Trailing Space <n@example.com> "
\
"Foo<u@example.com>"
\
'"Quotes <u@example.com>"'
;
do
printf
"# Maintainer: %s
\n
%s
\n
"
"
$m
"
"pkgname=foo"
>
APKBUILD
atf_check
-s
not-exit:0
\
-e
match:
"ERROR:"
\
abuild check_maintainer
done
for
m
in
"Test User <123@example.com>"
"Foo O'Brian <n@example.com>"
"Łukasz Something <s@example.com>"
;
do
printf
"# Maintainer: %s
\n
%s
\n
"
"
$m
"
"pkgname=foo"
>
APKBUILD
atf_check abuild check_maintainer
done
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment