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

Dan McGee dpmcgee at gmail.com
Tue May 19 00:05:19 EDT 2009


On Tue, May 12, 2009 at 4:02 AM, Cedric Staniewski <cedric at gmx.ca> wrote:
> 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

Isn't this a bit late to be catching this? Shouldn't we be doing this
in makepkg instead?

>                error "$(gettext "Invalid package file '%s'.")" "$pkgfile"
>                return 1
>        fi
> --


More information about the pacman-dev mailing list