[pacman-dev] Fwd: [BUG] chk_filedifference is buggy!!

Dan McGee dpmcgee at gmail.com
Mon Feb 11 10:50:11 EST 2008

On Feb 11, 2008 8:34 AM, Nagy Gabor <ngaba at bibl.u-szeged.hu> wrote:
> Part II [the real problem].
> Hi!
> This is the next part of my previous e-mail.
> After some investigation I figured out that chk_filedifference is the reason
> of the bug:
> The different pB==NULL handling is a good indicator of the bug (which is
> totally needless in bugfree chk_filedifference): almost the same happens here.
> The problem is the "while(pA && pB)"; if we reach the end of pB first, then
> the remaining pA is cut down...
> As an illustration I attached an other failing pactest file, which also
> demonstrates this clearly (and tests a now not checked case).

Nagy, we've discussed this before in the past. *Please* do not just
point out problems with the expectation that we will fix it. I know
you are a very competent coder, and I'd appreciate you contributing
solutions rather than inferring our code is shit. Saying things like
"totally needless" does not start things off on the right foot with
Aaron and I, who have really tried hard to clean up some questionable
code. We do make mistakes.

diff --git a/lib/libalpm/conflict.c b/lib/libalpm/conflict.c
index c093705..9ef5c9f 100644
--- a/lib/libalpm/conflict.c
+++ b/lib/libalpm/conflict.c
@@ -279,6 +279,12 @@ static alpm_list_t
*chk_filedifference(alpm_list_t *filesA, alpm_list_t *filesB)
+       /* ensure we have completely emptied pA */
+       while(pA) {
+               const char *strA = pA->data;
+               ret = alpm_list_add(ret, strdup(strA));
+               pA = pA->next;
+       }


This patch fixes the revised upgrade040 and 041 pactests, as well as
upgrade011 as attached. It doesn't fix upgrade046.py. Any thoughts for
that issue? I'm not familiar enough with the whole program flow there


More information about the pacman-dev mailing list