Bug 90785 - Erasing with rpmlib can cause weird rpm -q inconsistency
Summary: Erasing with rpmlib can cause weird rpm -q inconsistency
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: rpm   
(Show other bugs)
Version: 9
Hardware: i686
OS: Linux
Target Milestone: ---
Assignee: Jeff Johnson
QA Contact: Mike McLean
Depends On:
TreeView+ depends on / blocked
Reported: 2003-05-13 18:57 UTC by Greg Hudson
Modified: 2007-04-18 16:53 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2003-05-13 20:47:09 UTC
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
Test program to cause rpm -q inconsistency (760 bytes, text/plain)
2003-05-13 18:58 UTC, Greg Hudson
no flags Details

Description Greg Hudson 2003-05-13 18:57:25 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2.1) Gecko/20030108

Description of problem:
Using the attached sample program to erase the ash rpm, I get an odd
inconsistency from "rpm -q ash":

-bash-2.05b# cc -static -I/usr/include/rpm sample.c -o sample -lrpm -lrpmio
-lrpmdb -lpopt -lz -lbz2 -lpthread -lelf
-bash-2.05b# rpm -i ash-0.3.8-8.i386.rpm 
warning: ash-0.3.8-8.i386.rpm: V3 DSA signature: NOKEY, key ID db42a60e
-bash-2.05b# rpm -q ash
-bash-2.05b# ./sample
-bash-2.05b# rpm -q ash
-bash-2.05b# su daemon -c 'rpm -q ash'
package ash is not installed
-bash-2.05b# rpm -q ash
-bash-2.05b# rpm -qa | grep '^ash'
-bash-2.05b# rpm -q ash
package ash is not installed

This behavior seems eminently reproducible.  I can get it with either rpm-4.2-1
or Red Hat 9's native rpm-4.2-0.69.  "rpm -e ash" does not seem to cause the
same problem, even though it makes a very similar series of rpmts calls.  I have
seen the problem on two different machines, and starting with "rpm --rebuilddb"
doesn't change anything, so I don't think this is a problem specific to borked

Occasionally the rpm -qa command will produce an error message like:

error: rpmdbNextIterator: skipping h#     809 region trailer: BAD, tag
1650864740 type 1664692837 offset -858995046 count 909456944

but usually it does not.

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1. Compile attached sample program against rpm-4.2-0.69 or rpm-4.2-1.
2. Run it on a machine with the ash rpm installed.
3. Note that "rpm -q ash" run as root still reports the ash rpm.
4. Note that "rpm -q ash" run as non-root does not report the ash rpm.
5. Note that "rpm -qa | grep '^ash'" does not report the ash rpm.
6. Note that after step 5, "rpm -q ash" run as root no longer reports
   the ash rpm.

Additional info:

Comment 1 Greg Hudson 2003-05-13 18:58:17 UTC
Created attachment 91651 [details]
Test program to cause rpm -q inconsistency

Comment 2 Jeff Johnson 2003-05-13 20:47:09 UTC
I believe you need -L/usr/lib/nptl when linking statically
with posix mutexes in libpthread.

Alternatively (and the pathway rpm has chosen, there are many reasons)
is to abandon static linking until the NPTL transition is over.

I don't think I have a prayer of reproducing
this problem locally, so I'm gonna close.

Feel free to reopen if you need more help.

Comment 3 Jeff Johnson 2003-05-13 20:56:50 UTC
BTW, the cryptic error message is an indication of
data inconsistency.

If you choose a package that has a header SHA1 (i.e.
a package built with rpm-4.1 or later) tag, you
will get a stronger test of header data consistency than
the sanity check on values, which, of necessity,
cannot ever be perfect.

Any package displayed by
    rpm -qavv 2>&1 | grep OK | grep -v sanity
has a header SHA1 digest.

Note You need to log in before you can comment on or make changes to this bug.