Bug 239586

Summary: another inconsistent python binding
Product: [Fedora] Fedora Reporter: Curtis Doty <curtis>
Component: rpmAssignee: Panu Matilainen <pmatilai>
Status: CLOSED RAWHIDE QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: rawhideCC: herrold, redhat-bugzilla
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2007-06-26 07:52:17 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:

Description Curtis Doty 2007-05-09 17:40:19 UTC
The RPMTAG_FILEVERIFYFLAGS tag returns inconsistent results to python. It
appears to be same issue as:

* Wed Jun 28 2006 Paul Nasrat <pnasrat> - 4.4.2-26 
- Force CHANGELOGTIME to be a list in rpm-python

The bug can be reproduced by querying any package with only one file. The return
val will be <type 'int'> instead of the expected <type 'list'>.

Comment 1 Jeff Johnson 2007-05-09 17:53:59 UTC
The Right Fix for determining all possible pythonically perfect returns is to use this function

/**
 * Return tag data type from value.
 * @param tag           tag value
 * @return              tag data type, RPM_NULL_TYPE on not found.
 */
/*@unused@*/ static inline
int tagType(int tag)
        /*@*/
{
/*@-type@*/
    return ((*rpmTags->tagType)(tag));
/*@=type@*/
}

The rpm-python maintainer appears to be AWOL, so I'll add the changes myself to rpm-python-4.4.9 
this weekend.

Comment 2 Curtis Doty 2007-05-09 19:40:10 UTC
So that Right Fix would preclude the need fo more patches like this?

--- rpm/python/header-py.c.orig
+++ rpm/python/header-py.c
@@ -537,6 +537,8 @@
     case RPMTAG_CONFLICTNAME:
     case RPMTAG_CONFLICTFLAGS:
     case RPMTAG_CONFLICTVERSION:
+    case RPMTAG_CHANGELOGTIME:
+    case RPMTAG_FILEVERIFYFLAGS:
 	forceArray = 1;
 	break;
     case RPMTAG_SUMMARY:


Comment 3 Jeff Johnson 2007-05-09 22:17:06 UTC
Yes. Whether the tag is an array is buried in the tagType return value.

Comment 5 Curtis Doty 2007-05-12 05:33:21 UTC
Then this confuses me. :-/

http://hg.rpm.org/rpm?cs=08400e947833

Half a patch that never needed to exist in the first place?

But seriously. If the hacks need to keep swimming upstream, please send *all* of
them. Otherwise Jeff's idea of Right and proper binding must prevail.

Comment 6 Jeff Johnson 2007-05-13 20:09:44 UTC
Your choice depends on rpm.org != wraptastic.org for rpm. Fork you!

FWIW, Paul Nasrat is the rpm-python maintainer (I wrote the current
python bindings in rpm-4.4.2 during RHL8 release ) of record.

tagType() was implemented to assist with the Gawd Awful python object
typing (for Pau)l like 2 years ago. FWIW, there are 2 linear searches on
tag names, a largish performance hit in rpm-pythion, that have also been fixed (by
using bsearch) to help Paul pretend to be an "official" rpm-python
maintainer as well.

Paul been AWOL for quite some time ...

Do the math.

Comment 7 Panu Matilainen 2007-06-05 12:42:05 UTC
The dumb but trivial fix extending the switch-case applied to rpm.org for the
next maintenance release, will look into tagType() later on.

Comment 8 Panu Matilainen 2007-06-26 07:52:17 UTC
Fixed in next rawhide push by rpm 4.4.2.1-rc1