The infamous off_t patch ...

Panu Matilainen pmatilai at laiskiainen.org
Wed Jun 21 12:21:15 PDT 2006


On Wed, 2006-06-21 at 19:39 +0300, Panu Matilainen wrote:
> ..or r209:210 in svn terms was worth the name afterall. Other things
> seem to be ok but apt-cache (eg "apt-cache search xxxxx"), synaptic and
> apt-shell on some operations die with the following when it's applied
> rpmdb.c:2553: rpmdbInitIterator: Assertion `keylen == sizeof(k->ui)'
> failed.
> 
> Duh. Now to figure out what causes that... it seems to be related to
> rpmdb handler jumping through the roof when trying to look up something
> from pkgrecords, eg package summary and description.

Yeah, it's RPMDBHandler::Jump() to anything that dies because rpmdb
index size is uint_32 (at the moment) and sizeof(uint_32) is different
from sizeof(off_t) which triggers the assertion inside rpmdb.

Something like this cures it .. but the hardcoded uint_32 type doesn't
feel right, it probably should be some rpmdb index type from rpmdb.h or
thereabouts, but which type to use .. I dunno:

--- rpmhandler.cc       (revision 223)
+++ rpmhandler.cc       (working copy)
@@ -846,14 +846,17 @@
 {
    iOffset = Offset;
 #if RPM_VERSION >= 0x040000
+   uint_32 rpmOffset = iOffset;
    if (RpmIter == NULL)
       return false;
    rpmdbFreeIterator(RpmIter);
    if (iOffset == 0)
       RpmIter = rpmxxInitIterator(Handler, RPMDBI_PACKAGES, NULL, 0);
-   else
+   else {
       RpmIter = rpmxxInitIterator(Handler, RPMDBI_PACKAGES,
-                                 &iOffset, sizeof(iOffset));
+                                 &rpmOffset, sizeof(rpmOffset));
+      iOffset = rpmOffset;
+   }
    HeaderP = rpmdbNextIterator(RpmIter);
 #else
    HeaderP = rpmdbGetRecord(Handler, iOffset);


	- Panu -




More information about the Apt-Rpm mailing list