quilt-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Quilt-dev] [PATCH] push: Check for duplicate patch in series


From: Jean Delvare
Subject: Re: [Quilt-dev] [PATCH] push: Check for duplicate patch in series
Date: Thu, 27 Feb 2014 09:25:18 +0100

Le Wednesday 26 February 2014 à 21:02 +0100, Jean Delvare a écrit :
> In the case of a generated or manually tweaked series file, it can
> happen that the same patch shows up twice in the series file. Check
> for this before pushing any patch, otherwise we would corrupt quilt's
> internal database.
> 
> This fixes bug #20628:
> https://savannah.nongnu.org/bugs/?20628
> ---
> (...)
> --- quilt.orig/quilt/push.in  2014-01-20 12:02:58.874246011 +0100
> +++ quilt/quilt/push.in       2014-02-26 18:18:27.093721147 +0100
> @@ -177,6 +177,16 @@ add_patch()
>       local patch_file=$(patch_file_name "$patch")
>       local file status tmp
>  
> +     # In theory, the patch can't be already applied. However in the case
> +     # of a generated or manually tweaked series file, this could happen and
> +     # cause havoc, so play it safe and check.
> +     if is_applied "$patch"
> +     then
> +             printf $"Patch %s is already applied; check your series file\n" 
> \
> +                    "$(print_patch "$patch")"
> +             return 1
> +     fi
> +
>       printf $"Applying patch %s\n" "$(print_patch "$patch")"
>       trap "interrupt $patch" SIGINT
>  

Hmm, this first naive attempts is bad performance-wise. We call grep and
sed for every patch we check, and the list we grep grows with every
patch we apply, making it an O(n^2) algorithm.

I benchmarked this patch on a very large patch series (14805 patches)
and "quilt push -qa" took ~25% more time to complete. This is hardly
acceptable. I'll try to come up with a smarter and faster (and hopefully
linear in complexity) way to check for duplicate patches in series.

-- 
Jean Delvare
Suse L3 Support




reply via email to

[Prev in Thread] Current Thread [Next in Thread]