RPM Community Forums

Mailing List Message of <rpm-devel>

Re: damaged headers are due to FILESTATES RPM_CHAR_TYPE

From: Alexey Tourbin <at@altlinux.ru>
Date: Fri 29 Aug 2008 - 12:11:32 CEST
Message-ID: <20080829101132.GU6477@altlinux.org>
On Wed, Aug 27, 2008 at 12:55:06PM -0400, Jeff Johnson wrote:
> >$ ./rpm -q -vvv --whatprovides /a
> >D: opening  db index       /var/lib/rpm/Packages rdonly mode=0x0
> >D: locked   db index       /var/lib/rpm/Packages
> >D: opening  db index       /var/lib/rpm/Basenames rdonly mode=0x0
> >error: rpmdb: damaged header #625 retrieved -- skipping.
> >error: rpmdb: damaged header #625 retrieved -- skipping.
> >D: opening  db index       /var/lib/rpm/Providename rdonly mode=0x0
> >file /a: No such file or directory
> >D: closed   db index       /var/lib/rpm/Providename
> >D: closed   db index       /var/lib/rpm/Basenames
> >D: closed   db index       /var/lib/rpm/Packages
> >$ ./rpm -q -vvv --whatprovides /bin/cat
> >D: opening  db index       /var/lib/rpm/Packages rdonly mode=0x0
> >D: locked   db index       /var/lib/rpm/Packages
> >D: opening  db index       /var/lib/rpm/Basenames rdonly mode=0x0
> >error: rpmdb: damaged header #90 retrieved -- skipping.
> >error: rpmdb: damaged header #90 retrieved -- skipping.
> >error: rpmdb: damaged header #531 retrieved -- skipping.
> >error: rpmdb: damaged header #585 retrieved -- skipping.
> >error: rpmdb: damaged header #1101 retrieved -- skipping.
> >error: rpmdb: damaged header #1173 retrieved -- skipping.
> >D: opening  db index       /var/lib/rpm/Providename rdonly mode=0x0
> >file /bin/cat is not owned by any package
> >D: closed   db index       /var/lib/rpm/Providename
> >D: closed   db index       /var/lib/rpm/Basenames
> >D: closed   db index       /var/lib/rpm/Packages
> >$
> >
> >(I don't know why --whatprovides is special; simple -q queries
> >whithout join-key lookup work fine.)
> >
> 
> Hmmm, there is nothing special abt --whatprovides that should wander
> into code that depends on RPM_MIN_TYPE (unless I'm missing something).
> 
> RPMTAG_FILESTATES is the only tag that was ever type'd as RPM_CHAR_TYPE
> iirc. And here are the uses, none of the code is directly on a query  
> code path (this is HEAD):

There's a code that handles this case.

rpmdb/header_internal.c:
    36  int headerVerifyInfo(rpmuint32_t il, rpmuint32_t dl, const void * pev, void * iv, int negate)
    37  {
    38  /*@-castexpose@*/
    39      entryInfo pe = (entryInfo) pev;
    40  /*@=castexpose@*/
    41      entryInfo info = iv;
    42      rpmuint32_t i;
    43  
(The following line was added by me.)
    44      fprintf(stderr, "headerVerifyInfo\n");
    45  
    46      for (i = 0; i < il; i++) {
    47          info->tag = (rpmuint32_t) ntohl(pe[i].tag);
    48          info->type = (rpmuint32_t) ntohl(pe[i].type);
    49          /* XXX Convert RPMTAG_FILESTATE to RPM_UINT8_TYPE. */
    50          if (info->tag == 1029 && info->type == 1) {
    51              info->type = RPM_UINT8_TYPE;
    52              pe[i].type = (rpmuint32_t) htonl(info->type);
    53          }

Now, for some reason, certain rpmquery calls do trigger headerVerifyInfo
call, and others do not.

$ ./rpm -q --qf '%{NAME}\n' coreutils              
headerVerifyInfo                                            
headerVerifyInfo
headerVerifyInfo
headerVerifyInfo
headerVerifyInfo
headerVerifyInfo
headerVerifyInfo
headerVerifyInfo
headerVerifyInfo
coreutils
$ ./rpm -q --qf '%{NAME}\n' --whatprovides /bin/cat
error: rpmdb: damaged header #90 retrieved -- skipping.
error: rpmdb: damaged header #90 retrieved -- skipping.
error: rpmdb: damaged header #531 retrieved -- skipping.
error: rpmdb: damaged header #585 retrieved -- skipping.
error: rpmdb: damaged header #1101 retrieved -- skipping.
error: rpmdb: damaged header #1173 retrieved -- skipping.
file /bin/cat is not owned by any package
$

9 headerVerifyInfo() calls with '-q' and no single headerVerifyInfo()
call with '-q --whatprovides'.


  • application/pgp-signature attachment: stored
Received on Fri Aug 29 12:11:33 2008
Driven by Jeff Johnson and the RPM project team.
Hosted by OpenPKG and Ralf S. Engelschall.
Powered by FreeBSD and OpenPKG.