[pacman-dev] [PATCH v1] paccache: parse_filename bug fix

Dave Reisner d at falconindy.com
Mon Sep 29 23:09:49 UTC 2014


On Mon, Sep 29, 2014 at 01:06:00AM +0200, Maxim Andersson wrote:
> Filenames got parsed wrongly, causing whitelist- and blacklist-checks to always return false.
> 
> Bug appeared when full path names to pkgs were introduced.
> 
> Signed-off-by: Maxim Andersson <thesilentboatman at gmail.com>
> ---
>  contrib/paccache.sh.in | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/contrib/paccache.sh.in b/contrib/paccache.sh.in
> index eba315c..ce64d93 100644
> --- a/contrib/paccache.sh.in
> +++ b/contrib/paccache.sh.in
> @@ -56,9 +56,11 @@ pkgfilter() {
>  	# script after the block of awk.
>  
>  	awk -v keep="$1" -v scanarch="$2" '
> -	function parse_filename(filename,     parts, count, i, pkgname, arch) {
> +	function parse_filename(filename,     basename, parts, count, i, pkgname, arch) {
>  
> -		count = split(filename, parts, "-")
> +		basename = filename
> +		sub(".*/", "", basename)
> +		count = split(basename, parts, "-")

Thanks! I think I'd rather see this as a separate function though --
mostly to limit the scoping madness in the function proto.

I've pulled your patch to my branch, made this change, and amended the
commit message to include the exact commit when this broke.

>  
>  		i = 1
>  		pkgname = parts[i++]
> -- 
> 2.1.1


More information about the pacman-dev mailing list