Bug 239586 - another inconsistent python binding
another inconsistent python binding
Status: CLOSED RAWHIDE
Product: Fedora
Classification: Fedora
Component: rpm (Show other bugs)
rawhide
All Linux
medium Severity medium
: ---
: ---
Assigned To: Panu Matilainen
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2007-05-09 13:40 EDT by Curtis Doty
Modified: 2007-11-30 17:12 EST (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2007-06-26 03:52:17 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Curtis Doty 2007-05-09 13:40:19 EDT
The RPMTAG_FILEVERIFYFLAGS tag returns inconsistent results to python. It
appears to be same issue as:

* Wed Jun 28 2006 Paul Nasrat <pnasrat@redhat.com> - 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 13:53:59 EDT
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 15:40:10 EDT
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 18:17:06 EDT
Yes. Whether the tag is an array is buried in the tagType return value.
Comment 5 Curtis Doty 2007-05-12 01:33:21 EDT
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 16:09:44 EDT
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 08:42:05 EDT
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 03:52:17 EDT
Fixed in next rawhide push by rpm 4.4.2.1-rc1 

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