]>
Commit | Line | Data |
---|---|---|
900eb2ad JR |
1 | diff -dur rpm-5.4.12.orig/lib/rpmal.c rpm-5.4.12/lib/rpmal.c |
2 | --- rpm-5.4.12.orig/lib/rpmal.c 2012-04-15 23:20:57.000000000 +0200 | |
3 | +++ rpm-5.4.12/lib/rpmal.c 2013-08-13 13:46:28.000000000 +0200 | |
4 | @@ -7,6 +7,10 @@ | |
5 | #include <rpmio.h> | |
6 | #include <rpmiotypes.h> /* XXX fnpyKey */ | |
7 | #include <rpmbf.h> | |
8 | +#include <rpmlog.h> | |
9 | + | |
10 | +#define _RPMFI_INTERNAL | |
11 | +#include <rpmfi.h> | |
12 | ||
13 | #include <rpmtag.h> | |
14 | #include <rpmtypes.h> | |
15 | @@ -38,6 +42,7 @@ | |
16 | rpmds provides; /*!< Provides: dependencies. */ | |
17 | /*@refcounted@*/ /*@null@*/ | |
18 | rpmbf bf; /*!< File name Bloom filter. */ | |
19 | + rpmfi fi; /*!< File name Bloom filter. */ | |
20 | ||
21 | rpmuint32_t tscolor; /*!< Transaction color bits. */ | |
22 | ||
23 | @@ -149,6 +154,8 @@ | |
24 | alp->provides = NULL; | |
25 | (void)rpmbfFree(alp->bf); | |
26 | alp->bf = NULL; | |
27 | + (void)rpmfiFree(alp->fi); | |
28 | + alp->fi = NULL; | |
29 | } | |
30 | ||
31 | al->list = _free(al->list); | |
32 | @@ -205,6 +212,8 @@ | |
33 | alp->provides = NULL; | |
34 | (void)rpmbfFree(alp->bf); | |
35 | alp->bf = NULL; | |
36 | + (void)rpmfiFree(alp->fi); | |
37 | + alp->fi = NULL; | |
38 | ||
39 | memset(alp, 0, sizeof(*alp)); /* XXX trash and burn */ | |
40 | return; | |
41 | @@ -244,6 +253,7 @@ | |
42 | /*@-assignexpose -castexpose @*/ | |
43 | alp->provides = rpmdsLink(provides, "Provides (rpmalAdd)"); | |
44 | alp->bf = rpmbfLink(rpmfiFNBF(fi)); | |
45 | + alp->fi = rpmfiLink(fi, "file list (rpmalAdd)"); | |
46 | /*@=assignexpose =castexpose @*/ | |
47 | ||
48 | rpmalFreeIndex(al); | |
49 | @@ -350,17 +360,17 @@ | |
50 | rpmalAllFileSatisfiesDepend(const rpmal al, const rpmds ds, alKey * keyp) | |
51 | { | |
52 | fnpyKey * ret = NULL; | |
53 | - int found = 0; | |
54 | + int found = 0, verified = 0; | |
55 | const char * fn; | |
56 | size_t nfn; | |
57 | - int i; | |
58 | + int i, j; | |
59 | ||
60 | if (keyp) *keyp = RPMAL_NOMATCH; | |
61 | ||
62 | if (al == NULL || (fn = rpmdsN(ds)) == NULL || *fn != '/') | |
63 | goto exit; | |
64 | nfn = strlen(fn); | |
65 | - | |
66 | + | |
67 | if (al->list != NULL) /* XXX always true */ | |
68 | for (i = 0; i < al->size; i++) { | |
69 | availablePackage alp = al->list + i; | |
70 | @@ -368,6 +378,24 @@ | |
71 | if (!rpmbfChk(alp->bf, fn, nfn)) | |
72 | continue; | |
73 | ||
74 | + verified = 0; | |
75 | + char * fifn = (char *) malloc(alp->fi->fnlen + 1); | |
76 | + for(j=0; j<(int)alp->fi->fc; j++) { | |
77 | + const char * dn = NULL; | |
78 | + (void) urlPath(alp->fi->dnl[alp->fi->dil[j]], &dn); | |
79 | + strcpy(stpcpy(fifn, dn), alp->fi->bnl[j]); | |
80 | + if (!strcmp(fn, fifn)) { | |
81 | + verified = 1; | |
82 | + break; | |
83 | + } | |
84 | + } | |
85 | + free(fifn); | |
86 | + | |
87 | + if (!verified) { | |
88 | + rpmlog(RPMLOG_DEBUG, " False positive: '%s'\n", fn); | |
89 | + continue; | |
90 | + } | |
91 | + | |
92 | rpmdsNotify(ds, _("(added files)"), 0); | |
93 | ||
94 | ret = (fnpyKey *) xrealloc(ret, (found + 2) * sizeof(*ret)); |