[packages/rpm] - fix for Bloom filter giving false positives dependency checks breaking package install order, pa

baggins baggins at pld-linux.org
Tue Aug 13 20:16:34 CEST 2013


commit 900eb2adaaa06f024246a217b44226ef8754b233
Author: Jan Rękorajski <baggins at pld-linux.org>
Date:   Tue Aug 13 19:58:29 2013 +0200

    - fix for Bloom filter giving false positives dependency checks
      breaking package install order, patch by Jacek Konieczny, see
      http://lists.pld-linux.org/mailman/pipermail/pld-devel-en/2013-August/023630.html

 rpm-double_check_file_deps.patch | 94 ++++++++++++++++++++++++++++++++++++++++
 rpm.spec                         |  2 +
 2 files changed, 96 insertions(+)
---
diff --git a/rpm.spec b/rpm.spec
index 214bdce..4b6eeef 100644
--- a/rpm.spec
+++ b/rpm.spec
@@ -156,6 +156,7 @@ Patch71:	%{name}-changelog-encoding.patch
 Patch72:	%{name}-preserve-tag-type.patch
 Patch73:	gem_helper-spec-arg.patch
 Patch74:	rpm-fix-internal-lua-build.patch
+Patch75:	rpm-double_check_file_deps.patch
 
 # Patches imported from Mandriva
 
@@ -895,6 +896,7 @@ Dokumentacja API RPM-a oraz przewodniki w formacie HTML generowane ze
 %patch72 -p1
 %patch73 -p1
 %patch74 -p1
+%patch75 -p1
 
 %patch1000 -p1
 %patch1001 -p1
diff --git a/rpm-double_check_file_deps.patch b/rpm-double_check_file_deps.patch
new file mode 100644
index 0000000..58000a5
--- /dev/null
+++ b/rpm-double_check_file_deps.patch
@@ -0,0 +1,94 @@
+diff -dur rpm-5.4.12.orig/lib/rpmal.c rpm-5.4.12/lib/rpmal.c
+--- rpm-5.4.12.orig/lib/rpmal.c	2012-04-15 23:20:57.000000000 +0200
++++ rpm-5.4.12/lib/rpmal.c	2013-08-13 13:46:28.000000000 +0200
+@@ -7,6 +7,10 @@
+ #include <rpmio.h>
+ #include <rpmiotypes.h>		/* XXX fnpyKey */
+ #include <rpmbf.h>
++#include <rpmlog.h>
++
++#define _RPMFI_INTERNAL
++#include <rpmfi.h>
+ 
+ #include <rpmtag.h>
+ #include <rpmtypes.h>
+@@ -38,6 +42,7 @@
+     rpmds provides;		/*!< Provides: dependencies. */
+ /*@refcounted@*/ /*@null@*/
+     rpmbf bf;			/*!< File name Bloom filter. */
++    rpmfi fi;			/*!< File name Bloom filter. */
+ 
+     rpmuint32_t tscolor;	/*!< Transaction color bits. */
+ 
+@@ -149,6 +154,8 @@
+ 	alp->provides = NULL;
+ 	(void)rpmbfFree(alp->bf);
+ 	alp->bf = NULL;
++	(void)rpmfiFree(alp->fi);
++	alp->fi = NULL;
+     }
+ 
+     al->list = _free(al->list);
+@@ -205,6 +212,8 @@
+     alp->provides = NULL;
+     (void)rpmbfFree(alp->bf);
+     alp->bf = NULL;
++    (void)rpmfiFree(alp->fi);
++    alp->fi = NULL;
+ 
+     memset(alp, 0, sizeof(*alp));	/* XXX trash and burn */
+     return;
+@@ -244,6 +253,7 @@
+ /*@-assignexpose -castexpose @*/
+     alp->provides = rpmdsLink(provides, "Provides (rpmalAdd)");
+     alp->bf = rpmbfLink(rpmfiFNBF(fi));
++    alp->fi = rpmfiLink(fi, "file list (rpmalAdd)");
+ /*@=assignexpose =castexpose @*/
+ 
+     rpmalFreeIndex(al);
+@@ -350,17 +360,17 @@
+ rpmalAllFileSatisfiesDepend(const rpmal al, const rpmds ds, alKey * keyp)
+ {
+     fnpyKey * ret = NULL;
+-    int found = 0;
++    int found = 0, verified = 0;
+     const char * fn;
+     size_t nfn;
+-    int i;
++    int i, j;
+ 
+     if (keyp) *keyp = RPMAL_NOMATCH;
+ 
+     if (al == NULL || (fn = rpmdsN(ds)) == NULL || *fn != '/')
+ 	goto exit;
+     nfn = strlen(fn);
+-
++    
+     if (al->list != NULL)	/* XXX always true */
+     for (i = 0; i < al->size; i++) {
+ 	availablePackage alp = al->list + i;
+@@ -368,6 +378,24 @@
+ 	if (!rpmbfChk(alp->bf, fn, nfn))
+ 	    continue;
+ 
++	verified = 0;
++    	char * fifn = (char *) malloc(alp->fi->fnlen + 1);
++	for(j=0; j<(int)alp->fi->fc; j++) {
++		const char * dn = NULL;
++		(void) urlPath(alp->fi->dnl[alp->fi->dil[j]], &dn);
++		strcpy(stpcpy(fifn, dn), alp->fi->bnl[j]);
++		if (!strcmp(fn, fifn)) {
++			verified = 1;
++			break;
++		}
++	}
++	free(fifn);
++	
++	if (!verified) {
++    		rpmlog(RPMLOG_DEBUG, "   False positive: '%s'\n", fn);
++		continue;
++	}
++        
+ 	rpmdsNotify(ds, _("(added files)"), 0);
+ 
+ 	ret = (fnpyKey *) xrealloc(ret, (found + 2) * sizeof(*ret));
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/rpm.git/commitdiff/f12f8a526cb287a152637d49fc4faa6d41ae3a14



More information about the pld-cvs-commit mailing list