teknoraver / rpms / rpm

Forked from rpms/rpm 4 months ago
Clone

Blame rpm-4.7.0-python-altnevr.patch

Panu Matilainen 61937a
commit 9322f737819a3d81088699b1d7fa667259245411
Panu Matilainen 61937a
Author: Panu Matilainen <pmatilai@redhat.com>
Panu Matilainen 61937a
Date:   Tue May 19 10:26:50 2009 +0300
Panu Matilainen 61937a
Panu Matilainen 61937a
    Don't mess up problem altNEVR in python ts.check() (rhbz#501068)
Panu Matilainen 61937a
    - the use of strrchr() silently casts away the const from the problem
Panu Matilainen 61937a
      set altNEVR string, which we then happily modify..
Panu Matilainen 61937a
    - similar to commit 62cc76e25cdfad78ac30bb28f626b474efdecddc
Panu Matilainen 61937a
Panu Matilainen 61937a
diff --git a/python/rpmts-py.c b/python/rpmts-py.c
Panu Matilainen 61937a
index e56e001..9877fbc 100644
Panu Matilainen 61937a
--- a/python/rpmts-py.c
Panu Matilainen 61937a
+++ b/python/rpmts-py.c
Panu Matilainen 61937a
@@ -365,7 +365,7 @@ fprintf(stderr, "*** rpmts_Check(%p) ts %p cb %p\n", s, s->ts, cbInfo.cb);
Panu Matilainen 61937a
 
Panu Matilainen 61937a
 	/* XXX TODO: rpmlib >= 4.0.3 can return multiple suggested keys. */
Panu Matilainen 61937a
 	while ((i = rpmpsNextIterator(psi)) >= 0) {
Panu Matilainen 61937a
-	    const char * needsName;
Panu Matilainen 61937a
+	    char * altNEVR, * needsName;
Panu Matilainen 61937a
 	    char * byName, * byVersion, * byRelease, *byArch;
Panu Matilainen 61937a
 	    char * needsOP, * needsVersion;
Panu Matilainen 61937a
 	    rpmsenseFlags needsFlags, sense;
Panu Matilainen 61937a
@@ -383,7 +383,7 @@ fprintf(stderr, "*** rpmts_Check(%p) ts %p cb %p\n", s, s->ts, cbInfo.cb);
Panu Matilainen 61937a
 
Panu Matilainen 61937a
 	    key = rpmProblemGetKey(p);
Panu Matilainen 61937a
 
Panu Matilainen 61937a
-	    needsName = rpmProblemGetAltNEVR(p);
Panu Matilainen 61937a
+	    altNEVR = needsName = xstrdup(rpmProblemGetAltNEVR(p));
Panu Matilainen 61937a
 	    if (needsName[1] == ' ') {
Panu Matilainen 61937a
 		sense = (needsName[0] == 'C')
Panu Matilainen 61937a
 			? RPMDEP_SENSE_CONFLICTS : RPMDEP_SENSE_REQUIRES;
Panu Matilainen 61937a
@@ -409,6 +409,7 @@ fprintf(stderr, "*** rpmts_Check(%p) ts %p cb %p\n", s, s->ts, cbInfo.cb);
Panu Matilainen 61937a
 	    PyList_Append(list, (PyObject *) cf);
Panu Matilainen 61937a
 	    Py_DECREF(cf);
Panu Matilainen 61937a
 	    free(byName);
Panu Matilainen 61937a
+	    free(altNEVR);
Panu Matilainen 61937a
 	}
Panu Matilainen 61937a
 
Panu Matilainen 61937a
 	psi = rpmpsFreeIterator(psi);