1
0
mirror of https://github.com/moparisthebest/pacman synced 2024-08-13 17:03:46 -04:00

Do not allow pkgnames to start with a hyphen

Commandline arguments starting with a hyphen are usually recognized as
options by unix tools. Therefore, allowing hyphens at the beginning of a
package name requires a different handling of pkgnames as suggested by
rm's manpage.
It would be possible to make the scripts 'hyphen-safe', but
hyphen-prefixed packages will cause trouble for pacman users which do
not know these tricks.

Signed-off-by: Cedric Staniewski <cedric@gmx.ca>
[Dan: remove the repo-add check]
Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
Cedric Staniewski 2009-06-09 21:33:12 +02:00 committed by Dan McGee
parent 2013d06266
commit fb97d325a5

View File

@ -1122,6 +1122,10 @@ check_sanity() {
error "$(gettext "%s is not allowed to be empty.")" "pkgrel"
return 1
fi
if [ "${pkgname:0:1}" == "-" ]; then
error "$(gettext "%s is not allowed to start with a hyphen.")" "pkgname"
return 1
fi
if [ "$pkgver" != "${pkgver//-/}" ]; then
error "$(gettext "%s is not allowed to contain hyphens.")" "pkgver"
return 1