summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2012-09-12 16:50:41 +0300
committerPanu Matilainen <pmatilai@redhat.com>2012-09-12 19:19:31 +0300
commita7c133471012122da669afbd2a45464ac64d886a (patch)
tree630dcb42727e7d882d30bd321ae865f1a6abea87
parent06546854933d0d7682bffbdf11c50c1efde17045 (diff)
downloadlibrpm-tizen-a7c133471012122da669afbd2a45464ac64d886a.tar.gz
librpm-tizen-a7c133471012122da669afbd2a45464ac64d886a.tar.bz2
librpm-tizen-a7c133471012122da669afbd2a45464ac64d886a.zip
Add a some transition-period asserts to ensure pool-usage sanity
-rw-r--r--lib/rpmal.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/rpmal.c b/lib/rpmal.c
index 577a39c17..a79c69742 100644
--- a/lib/rpmal.c
+++ b/lib/rpmal.c
@@ -90,6 +90,9 @@ rpmal rpmalCreate(rpmstrPool pool, int delta, rpmtransFlags tsflags,
{
rpmal al = xcalloc(1, sizeof(*al));
+ /* transition time safe-guard */
+ assert(pool != NULL);
+
al->pool = rpmstrPoolLink(pool);
al->delta = delta;
al->size = 0;
@@ -247,6 +250,22 @@ void rpmalAdd(rpmal al, rpmte p)
alp->provides = rpmdsLink(rpmteDS(p, RPMTAG_PROVIDENAME));
alp->fi = rpmfiLink(rpmteFI(p));
+ /*
+ * Transition-time safe-guard to catch private-pool uses.
+ * File sets with no files have NULL pool, that's fine. But WTF is up
+ * with the provides: every single package should have at least its
+ * own name as a provide, and thus never NULL, and normal use matches
+ * this expectation. However the test-suite is tripping up on NULL
+ * NULL pool from NULL alp->provides in numerous cases?
+ */
+ {
+ rpmstrPool fipool = rpmfiPool(alp->fi);
+ rpmstrPool dspool = rpmdsPool(alp->provides);
+
+ assert(fipool == NULL || fipool == al->pool);
+ assert(dspool == NULL || dspool == al->pool);
+ }
+
if (al->providesHash != NULL) { // index is already created
rpmalAddProvides(al, pkgNum, alp->provides);
rpmalAddFiles(al, pkgNum, alp->fi);