Unbreak fingerprinting when called twice for the same transaction set
authorPanu Matilainen <pmatilai@redhat.com>
Tue, 18 Sep 2012 16:04:40 +0000 (19:04 +0300)
committerPanu Matilainen <pmatilai@redhat.com>
Tue, 18 Sep 2012 16:14:34 +0000 (19:14 +0300)
- Fixes regression (yum updates barf with conflicts) from commit
  3b492620fb35a21d05b975e31130dc071f6fd8e2 which doesn't affect rpm
  itself but breaks some API users like yum that first run a
  test-transaction and if that succeeds, the same transaction is run
  for real. In that case we need to redo the whole fingerprint dance
  from scratch: throw away any former results and redo.
- Blaming Fedora 18 alpha preparations for not noticing this earlier:
  there have been no updates to F16/F17 in almost a week, effectively
  disabling a part of the regular rpm development QA :P

lib/rpmfi.c

index ad02117..cf968bd 100644 (file)
@@ -1293,7 +1293,10 @@ rpm_loff_t rpmfiFReplacedSizeIndex(rpmfi fi, int ix)
 
 void rpmfiFpLookup(rpmfi fi, fingerPrintCache fpc)
 {
-    if (fi->fc > 0 && fi->fps == NULL) {
+    /* This can get called twice (eg yum), scratch former results and redo */
+    if (fi->fc > 0) {
+       if (fi->fps)
+           free(fi->fps);
        fi->fps = fpLookupList(fpc, fi->pool,
                               fi->dnid, fi->bnid, fi->dil, fi->fc);
     }