Restrict pkgname from starting with a dot.

Adding this restriction means we can filter any FILENAME entry from
starting with a "/" or a ".".  Use the term "dot" as it is more
computing relevant compared to "full stop" or "period" which vary
depending on English locale.

Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
Allan McRae 2013-06-04 13:38:48 +10:00
parent f1d74d928a
commit fe794ccb25
2 changed files with 5 additions and 1 deletions

View file

@ -42,7 +42,7 @@ similar to `$_basekernver`.
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.
Valid characters for members of this array are alphanumerics, and any of Valid characters for members of this array are alphanumerics, and any of
the following characters: ```@ . _ + -`''. Additionally, names are not the following characters: ```@ . _ + -`''. Additionally, names are not
allowed to start with hyphens. allowed to start with hyphens or dots.
*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

@ -2111,6 +2111,10 @@ 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:0:1} = "." ]]; then
error "$(gettext "%s is not allowed to start with a dot.")" "pkgname"
ret=1
fi
if [[ $i = *[^[:alnum:]+_.@-]* ]]; then if [[ $i = *[^[:alnum:]+_.@-]* ]]; then
error "$(gettext "%s contains invalid characters: '%s'")" \ error "$(gettext "%s contains invalid characters: '%s'")" \
'pkgname' "${pkgname//[[:alnum:]+_.@-]}" 'pkgname' "${pkgname//[[:alnum:]+_.@-]}"