Bug 671149 - duplicate in package list
Summary: duplicate in package list
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: rpm
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
low
Target Milestone: ---
Assignee: Panu Matilainen
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-01-20 15:31 UTC by Miroslav Lichvar
Modified: 2011-01-21 13:00 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2011-01-21 12:17:40 UTC
Type: ---


Attachments (Terms of Use)
list rpm packages (752 bytes, text/x-csrc)
2011-01-20 15:31 UTC, Miroslav Lichvar
no flags Details

Description Miroslav Lichvar 2011-01-20 15:31:00 UTC
Created attachment 474476 [details]
list rpm packages

Description of problem:
While testing rpmreaper with the new librpm, I've noticed one package was listed twice. The package was listed only once in the rpm -qa output, so I'm wondering if the client should be responsible for removing duplicities. With older librpm this didn't happen. A reproducer is attached.

Version-Release number of selected component (if applicable):
rpm-4.9.0-0.beta1.1.fc15.x86_64

Comment 1 Panu Matilainen 2011-01-21 08:58:21 UTC
No,  you're not supposed to do duplicate filtering.

The semantics of rpmtsInitIterator() on an rpmdb index (such as RPMTAG_NAME) when called with NULL keyp changed in 4.9.x. Previously it silently fell back to RPMDBI_PACKAGES on that case, whereas it now walks the requested index (so for eg. obsoletes, it only returns the packages containing obsoletes instead of all).
There's something fishy going on here, whether it's an old flaw exposed by the semantics change, a problem in the new code or some other quirk I dunno yet, I'll look into it. Thanks for spotting and reporting this.

Aside from that: since rpmreaper always calls rpmtsInitIterator() with NULL keyp, ie "just give me all packages", you might as well use RPMDBI_PACKAGES directly  (which is what rpm itself uses here, hence the difference) instead of RPMTAG_NAME.

Comment 2 Panu Matilainen 2011-01-21 09:58:48 UTC
Ok, it's indeed a regression, related to the new automatic index population: the first package encountered on rebuilddb gets added twice to indexes. Will fix asap.

Comment 3 Panu Matilainen 2011-01-21 11:29:38 UTC
Hum, actually there appear to be two different bugs here. The one in comment #2 only happens after --rebuilddb has been done, but something else is causing the iteration to return one duplicate even when the index correct.

Comment 4 Panu Matilainen 2011-01-21 12:17:40 UTC
Okay, the second bug was an error in the iteration termination logic. Both issues should be fixed in rpm-4.9.0-0.beta1.3.fc15. Again, thanks for spotting and reporting this!

Comment 5 Miroslav Lichvar 2011-01-21 12:34:54 UTC
Thanks for looking into this and for the suggestion to use the RPMDBI_PACKAGES index, it seems to be a bit faster now.

Comment 6 Panu Matilainen 2011-01-21 13:00:02 UTC
Yup, using RPMDBI_PACKAGES is a tiny bit faster than going through secondary index when all the entries are being accessed. The indexes are only a win when looking up specific entires (eg by packages with certain name) and when not all packages have such entires (such as obsoletes).


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