From fb97d325a5f83cea36050472097e06c28bc2964f Mon Sep 17 00:00:00 2001 From: Cedric Staniewski Date: Tue, 9 Jun 2009 21:33:12 +0200 Subject: 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 [Dan: remove the repo-add check] Signed-off-by: Dan McGee --- scripts/makepkg.sh.in | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 6c4aeb8b..56ad2c0b 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -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 -- cgit v1.2.3-54-g00ecf