1
0
mirror of https://github.com/moparisthebest/pacman synced 2024-11-12 04:15:06 -05:00

makepkg: restrict allowed characters in pkgname

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
Dave Reisner 2012-04-13 15:40:30 -04:00 committed by Dan McGee
parent 133d174e60
commit 5f71570ec4
2 changed files with 8 additions and 2 deletions

View File

@ -40,8 +40,9 @@ similar to `$_basekernver`.
*pkgname (array)*:: *pkgname (array)*::
Either the name of the package or an array of names for split packages. Either the name of the package or an array of names for split packages.
Because it will be used in the package filename, this has to be unix-friendly. Valid characters for members of this array are alphanumerics, and any of
Members of the array are not allowed to start with hyphens. the following characters: ```@ . _ + -`''. Additionally, names are not
allowed to start with hyphens.
*pkgver*:: *pkgver*::
The version of the software as released from the author (e.g., '2.7.1'). The version of the software as released from the author (e.g., '2.7.1').

View File

@ -1454,6 +1454,11 @@ check_sanity() {
error "$(gettext "%s is not allowed to start with a hyphen.")" "pkgname" error "$(gettext "%s is not allowed to start with a hyphen.")" "pkgname"
ret=1 ret=1
fi fi
if [[ $i = *[^[:alnum:]+_.@-]* ]]; then
error "$(gettext "%s contains invalid characters: '%s'")" \
'pkgname' "${pkgname//[[:alnum:]+_.@-]}"
ret=1
fi
done done
if [[ ${pkgbase:0:1} = "-" ]]; then if [[ ${pkgbase:0:1} = "-" ]]; then