Bug 277161

Summary: Fault when querying against DSAHEADER
Product: [Fedora] Fedora Reporter: Ignacio Vazquez-Abrams <ivazqueznet>
Component: rpmAssignee: Panu Matilainen <pmatilai>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: low Docs Contact:
Priority: medium    
Version: rawhideCC: pnasrat, redhat-bugzilla
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: 4.4.2.2-2.fc7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2007-10-24 07:14:08 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
rpmq fault
none
rpmq trace none

Description Ignacio Vazquez-Abrams 2007-09-04 19:31:35 UTC
The following query results in a fault in rpm-4.4.2.1-1.fc7.i386:

rpm -qa "dsaheader=*30c9ecf8*"

Fault and trace attached.

Comment 1 Ignacio Vazquez-Abrams 2007-09-04 19:31:35 UTC
Created attachment 186491 [details]
rpmq fault

Comment 2 Ignacio Vazquez-Abrams 2007-09-04 19:32:15 UTC
Created attachment 186501 [details]
rpmq trace

Comment 3 Panu Matilainen 2007-09-05 07:10:50 UTC
Easily reproduced. There are actually a number of bugs here, urgh...
- matching against "binary blob" type (such as dsaheader) isn't handled at all
- attempting matching against binary blobs segfaults
- matching produces false results if the header to be matched against isn't
present in package(s)

Comment 4 Panu Matilainen 2007-09-05 10:47:47 UTC
Fixed in rpm.org HEAD, needs backporting to 4.4.2.2...

Comment 5 Jeff Johnson 2007-09-06 06:50:30 UTC
Sure there are any number of bugs retrieving a header tag by regex retrieval applied against
binary data, now converted to text. I will likely steal the patch soon, but implement rather differently.
headerGetExtension is ther to to coerce data types onto tags.

However, the functionality of the access itself makes no sense. Loading every header to retrieve
RPMTAG_DSAHEADER which is converted to hex so that a pattern can be applied to find which
packages were signed with the pubkey
    gpg(Fedora Project (Test Software) <rawhide>)
should be done with a --queryformat, not a regex. You won't be happy with the
false positives from the pattern match even if you are willing to live with the performance
cost of loading every installed header.

I.e. blocking regexes appled to binary data, rather than drilling the hex convert through
mireFoo() is likely more useful.  And if there is a need for retrieving packages signed with
a specific pubkey fingerprint, then an index (for highest performance), or a popt alias
to hide a complex --queryformat to be post filtered with --pipe needs doing.

Comment 6 Panu Matilainen 2007-09-06 07:26:34 UTC
Yup, retrieving by signing key is somewhat different issue and wants
queryformat, not hex dumps. Converting binary to hex and matching is mostly of
academical interest, there's probably just one case where it might actually be
useful (sourcepkgid to be exact)

Comment 7 Ignacio Vazquez-Abrams 2007-09-06 10:13:23 UTC
In that case go ahead and close the report if the fault is fixed. I'll worry
about the actual querying part some other way.

Comment 8 Jeff Johnson 2007-09-06 12:09:51 UTC
If Sourcepkgid: is the issue, its value in packages should be changed to a string.

Querying by pkgid is already drilled with an index for performance. Querying by
sourcepkgid is no harder than changing a tag.

Comment 9 Jeff Johnson 2007-09-06 12:36:29 UTC
Since sourcepkgid is not currently included in Fedora packages, pattern matching against
a non-existent tag is likely of academic interest only as well.

Comment 10 Panu Matilainen 2007-09-11 07:29:03 UTC
Fixed in next rawhide push by rpm 4.4.2.2-rc2

Comment 11 Fedora Update System 2007-10-12 20:02:36 UTC
rpm-4.4.2.2-2.fc7 has been pushed to the Fedora 7 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update rpm'

Comment 12 Fedora Update System 2007-10-24 07:13:56 UTC
rpm-4.4.2.2-2.fc7 has been pushed to the Fedora 7 stable repository.  If problems still persist, please make note of it in this bug report.