Bug 1693773 - keychecker: Switch to a string for RPM calls (oncoming rpm API fix change)
Summary: keychecker: Switch to a string for RPM calls (oncoming rpm API fix change)
Keywords:
Status: NEW
Alias: None
Product: Fedora
Classification: Fedora
Component: keychecker
Version: 31
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Jon Stanley
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: 1693751 1779194
TreeView+ depends on / blocked
 
Reported: 2019-03-28 15:29 UTC by Panu Matilainen
Modified: 2019-12-03 13:47 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed:
Type: Bug


Attachments (Terms of Use)

Description Panu Matilainen 2019-03-28 15:29:02 UTC
Description of problem:

Rpm's python3 API has been totally braindamaged all this time but people are only noticing now that it's starting to get used. 

We're changing rpm to return all string data as surrogate-escaped utf-8 python strings everywhere (instead of bytes with unknown encoding that the API doesn't otherwise even accept, see bug 1631292). This makes most rpm-scripts written for python2 just work with python3 too (from the rpm pov).

Most software that has kept python2 compatibility are automatically compatible with the fixed API, but unfortunately python3-only users need fixing for the new behavior.

There's several places in keychecker that are affected, there are explicit .decode() calls of rpm data at least in buildKeyList() and getPkgNevra() and getPkg() functions.

As the broken rpm versions are widely in use, it's best to keep compatibility with both initially. Basically replace all the hardcoded .decode("utf-8") calls to header data with something like this:

def b2s(data):
    if isinstance(data, bytes):
        return data.decode('utf-8')
    return data

Comment 1 Carl George 2019-03-28 16:21:29 UTC
Hey Panu, bug 1631292 is private.  Could you get that made public so I can read more about this?

Comment 2 Panu Matilainen 2019-03-29 06:57:59 UTC
Doh, seems there's one place I forgot to update in that mostly copy-pasted message, sorry :(
See the blocked bug for the public counterpart: https://bugzilla.redhat.com/show_bug.cgi?id=1693751

Comment 3 Ben Cotton 2019-08-13 17:03:19 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 31 development cycle.
Changing version to '31'.

Comment 4 Ben Cotton 2019-08-13 19:26:44 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 31 development cycle.
Changing version to 31.


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