[aur-dev] [PATCH] Fixed Null issue in git-interface/git-serve.py

Lukas Fleischer lfleischer at archlinux.org
Thu Nov 26 07:46:10 UTC 2015


On Thu, 26 Nov 2015 at 01:39:50, Mark Weiman wrote:
> Found while setting up a brand new instance of aurweb, in git-serve.py, if the PackageBases table is empty, it generates a TypeError.
> 
> "TypeError: unorderable types: NoneType() > int()"
> 
> Signed-off-by: Mark Weiman <mark.weiman at markzz.com>
> ---
>  git-interface/git-serve.py | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/git-interface/git-serve.py b/git-interface/git-serve.py
> index 8bd6aa8..6ba19e8 100755
> --- a/git-interface/git-serve.py
> +++ b/git-interface/git-serve.py
> @@ -37,7 +37,10 @@ def pkgbase_from_name(pkgbase):
>      return row[0] if row else None
>  
>  def pkgbase_exists(pkgbase):
> -    return (pkgbase_from_name(pkgbase) > 0)
> +    if pkgbase_from_name(pkgbase):
> +        return (pkgbase_from_name(pkgbase) > 0)
> +    else:
> +        return False

Good catch. However, I do not think that this is related to the
PackageBases table being empty. Whenever the given package base name
does not exist, pkgbase_from_name() returns None. It seems like the
current implementation of pkgbase_exists() is completely broken and

    def pkgbase_exists(pkgbase):
        return pkgbase_from_name(pkgbase) is not None

would be the right fix. Could you please resubmit your patch with that
change? Also amend the commit message, wrap at ~80 characters, switch to
imperative mood and maybe mention the commit that broke the function,
like

    Fixes a regression introduced in 8c87b1d (git-serve: Add support for
    setting keywords, 2015-10-22).

Thanks!

>  
>  def list_repos(user):
>      db = mysql.connector.connect(host=aur_db_host, user=aur_db_user,
> -- 
> 2.6.2


More information about the aur-dev mailing list