rpms/rpm/F-11 rpm-4.7.0-fp-findbyfile.patch, NONE, 1.1 rpm-4.7.0-fp-symlink.patch, NONE, 1.1 rpm.spec, 1.350, 1.351
Panu Matilainen
pmatilai at fedoraproject.org
Thu Jun 18 16:02:57 UTC 2009
Author: pmatilai
Update of /cvs/pkgs/rpms/rpm/F-11
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv25775
Modified Files:
rpm.spec
Added Files:
rpm-4.7.0-fp-findbyfile.patch rpm-4.7.0-fp-symlink.patch
Log Message:
- fix two fingerprinting issues (unrelated otherwise):
- segfault in symlink fingerprinting (#505777)
- invalid memory access causing bogus file dependency errors (#506323)
rpm-4.7.0-fp-findbyfile.patch:
--- NEW FILE rpm-4.7.0-fp-findbyfile.patch ---
diff --git a/lib/fprint.c b/lib/fprint.c
index e57ba20..c56b0e5 100644
--- a/lib/fprint.c
+++ b/lib/fprint.c
@@ -37,8 +37,10 @@ fingerPrintCache fpCacheCreate(int sizeHint)
fingerPrintCache fpCacheFree(fingerPrintCache cache)
{
- cache->ht = rpmFpEntryHashFree(cache->ht);
- free(cache);
+ if (cache) {
+ cache->ht = rpmFpEntryHashFree(cache->ht);
+ free(cache);
+ }
return NULL;
}
diff --git a/lib/rpmdb.c b/lib/rpmdb.c
index 439a974..d76630e 100644
--- a/lib/rpmdb.c
+++ b/lib/rpmdb.c
@@ -1098,20 +1098,20 @@ int rpmdbVerify(const char * prefix)
static int rpmdbFindByFile(rpmdb db, const char * filespec,
DBT * key, DBT * data, dbiIndexSet * matches)
{
- char * dirName;
+ char * dirName = NULL;
const char * baseName;
- fingerPrintCache fpc;
+ fingerPrintCache fpc = NULL;
fingerPrint fp1;
dbiIndex dbi = NULL;
DBC * dbcursor;
dbiIndexSet allMatches = NULL;
dbiIndexItem rec = NULL;
unsigned int i;
- int rc;
+ int rc = -2; /* assume error */
int xx;
*matches = NULL;
- if (filespec == NULL) return -2;
+ if (filespec == NULL) return rc; /* nothing alloced yet */
if ((baseName = strrchr(filespec, '/')) != NULL) {
size_t len = baseName - filespec + 1;
@@ -1123,11 +1123,7 @@ static int rpmdbFindByFile(rpmdb db, const char * filespec,
baseName = filespec;
}
if (baseName == NULL)
- return -2;
-
- fpc = fpCacheCreate(20);
- fp1 = fpLookup(fpc, dirName, baseName, 1);
- free(dirName);
+ goto exit;
dbi = dbiOpen(db, RPMTAG_BASENAMES, 0);
if (dbi != NULL) {
@@ -1154,16 +1150,14 @@ static int rpmdbFindByFile(rpmdb db, const char * filespec,
} else
rc = -2;
- if (rc) {
- allMatches = dbiFreeIndexSet(allMatches);
- fpc = fpCacheFree(fpc);
- return rc;
- }
+ if (rc || allMatches == NULL) goto exit;
*matches = xcalloc(1, sizeof(**matches));
rec = dbiIndexNewItem(0, 0);
+ fpc = fpCacheCreate(allMatches->count);
+ fp1 = fpLookup(fpc, dirName, baseName, 1);
+
i = 0;
- if (allMatches != NULL)
while (i < allMatches->count) {
struct rpmtd_s bn, dn, di;
const char ** baseNames, ** dirNames;
@@ -1216,16 +1210,19 @@ static int rpmdbFindByFile(rpmdb db, const char * filespec,
}
rec = _free(rec);
- allMatches = dbiFreeIndexSet(allMatches);
-
- fpc = fpCacheFree(fpc);
+ fpCacheFree(fpc);
if ((*matches)->count == 0) {
*matches = dbiFreeIndexSet(*matches);
- return 1;
+ rc = 1;
+ } else {
+ rc = 0;
}
- return 0;
+exit:
+ dbiFreeIndexSet(allMatches);
+ free(dirName);
+ return rc;
}
/* XXX python/upgrade.c, install.c, uninstall.c */
rpm-4.7.0-fp-symlink.patch:
--- NEW FILE rpm-4.7.0-fp-symlink.patch ---
commit 1b9e6d7f48a68fd677c70d04c9a6bb4274cf7b9f
Author: Florian Festi <ffesti at redhat.com>
Date: Tue Jun 16 17:37:40 2009 +0200
Fix Segfault for to be installed symlinks pointing to existing locations
fixes rhbz#505777
diff --git a/lib/fprint.c b/lib/fprint.c
index d32eec1..e57ba20 100644
--- a/lib/fprint.c
+++ b/lib/fprint.c
@@ -311,10 +311,10 @@ void fpLookupSubdir(rpmFpHash symlinks, rpmFpHash fphash, fingerPrintCache fpc,
/* setup current_fp for the new path */
found = 1;
current_fp = *fp;
- if (!fp->subDir) {
- lensubDir = 0;
- currentsubdir = endsubdir = NULL;
- break;
+ if (fp->subDir == NULL) {
+ /* directory exists - no need to look for symlinks */
+ rpmFpHashAddEntry(fphash, fp, ffi);
+ return;
}
lensubDir = strlen(fp->subDir);
currentsubdir = xstrdup(fp->subDir);
Index: rpm.spec
===================================================================
RCS file: /cvs/pkgs/rpms/rpm/F-11/rpm.spec,v
retrieving revision 1.350
retrieving revision 1.351
diff -u -p -r1.350 -r1.351
--- rpm.spec 18 Jun 2009 15:56:07 -0000 1.350
+++ rpm.spec 18 Jun 2009 16:02:55 -0000 1.351
@@ -47,6 +47,8 @@ Patch200: rpm-4.7.0-findlang-kde3.patch
Patch201: rpm-4.7.0-prtsig.patch
Patch202: rpm-4.7.0-python-altnevr.patch
Patch203: rpm-4.7.0-hardlink-sizes.patch
+Patch204: rpm-4.7.0-fp-symlink.patch
+Patch205: rpm-4.7.0-fp-findbyfile.patch
# These are not yet upstream
Patch300: rpm-4.7.0-extra-provides.patch
@@ -192,6 +194,8 @@ that will manipulate RPM packages and da
%patch201 -p1 -b .prtsig
%patch202 -p1 -b .py-altnevr
%patch203 -p1 -b .hardlink-sizes
+%patch204 -p1 -b .fp-symlink
+%patch205 -p1 -b .fp-findbyfile
%patch300 -p1 -b .extra-prov
%patch301 -p1 -b .niagara
@@ -410,6 +414,8 @@ exit 0
- fix pgp pubkey signature tag parsing
- don't mess up problem altNEVR in python ts.check() (#501068)
- fix hardlink size calculation on build (#503020)
+- fix segfault in symlink fingerprinting (#505777)
+- fix invalid memory access causing bogus file dependency errors (#506323)
* Thu Apr 16 2009 Panu Matilainen <pmatilai at redhat.com> - 4.7.0-1
- update to 4.7.0 final (http://rpm.org/wiki/Releases/4.7.0)
More information about the fedora-extras-commits
mailing list