diff options
author | Cedric Staniewski <cedric@gmx.ca> | 2009-06-09 21:33:12 +0200 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2009-07-27 06:29:55 +0200 |
commit | fb97d325a5f83cea36050472097e06c28bc2964f (patch) | |
tree | ff753e9e4622e2f4072dc6ccc3c2e5d977b8d2d6 | |
parent | 2013d062668e511289df50315bed33534ad71240 (diff) | |
download | pacman-fb97d325a5f83cea36050472097e06c28bc2964f.tar.gz pacman-fb97d325a5f83cea36050472097e06c28bc2964f.tar.xz |
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>
-rw-r--r-- | scripts/makepkg.sh.in | 4 |
1 files changed, 4 insertions, 0 deletions
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 |