[pacman-dev] [PATCH 3/3] repo-add: do not allow pkgnames to start with a minus

Cedric Staniewski cedric at gmx.ca
Tue May 12 05:02:30 EDT 2009


Signed-off-by: Cedric Staniewski <cedric at gmx.ca>
---
 scripts/repo-add.sh.in |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/scripts/repo-add.sh.in b/scripts/repo-add.sh.in
index eb8837c..2133fed 100644
--- a/scripts/repo-add.sh.in
+++ b/scripts/repo-add.sh.in
@@ -216,8 +216,8 @@ db_write_entry()
 	md5sum="$(openssl dgst -md5 "$pkgfile" | awk '{print $NF}')"
 	csize=$(@SIZECMD@ "$pkgfile")
 
-	# ensure $pkgname and $pkgver variables were found
-	if [ -z "$pkgname" -o -z "$pkgver" ]; then
+	# ensure $pkgname and $pkgver variables were found and pkgname does not start with a minus
+	if [ -z "$pkgname" -o "${pkgname:0:1}" == "-" -o -z "$pkgver" ]; then
 		error "$(gettext "Invalid package file '%s'.")" "$pkgfile"
 		return 1
 	fi
-- 
1.6.3



More information about the pacman-dev mailing list