Bug 1699790

Summary: fedpkg lint fails with: Could not execute lint: decoding str is not supported
Product: [Fedora] Fedora Reporter: Petr Pisar <ppisar>
Component: rpkgAssignee: cqi
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: cqi, dennis, jkeating, lsedlar, onosek, s
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-04-25 08:06:19 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Petr Pisar 2019-04-15 08:52:25 UTC
python3-rpm-4.14.2.1-6 started returning Unicode strings instead of byte strings in order to handle Unicode properly. (See bug #1693751 for more details.) As a result, a "fedpkg lint" command dies now on any repository:

$ fedpkg lint
Could not execute lint: decoding str is not supported

I have:

python3-rpm-4.14.2.1-7.fc31.x86_64
rpmlint-1.10-22.fc31.noarch
fedpkg-1.36-2.fc30.noarch

Comment 1 Ondřej Nosek 2019-04-25 08:03:00 UTC
python3-rpkg-1.57-8.fc31

Comment 2 Ondřej Nosek 2019-04-25 08:06:19 UTC
fixed in:
python3-rpkg-1.57-8.fc31

Comment 3 Petr Pisar 2019-04-25 10:04:39 UTC
Now it does not fail. That's great. But it reports this warning when running in a full-arch package repository (e.g. rpms/libffi):

$ fedpkg --release f31 lint
/usr/lib/python3.7/site-packages/pyrpkg/__init__.py:1241: UnicodeWarning: decode() called on unicode string, see https://bugzilla.redhat.com/show_bug.cgi?id=1693751
  return [arch.decode('utf-8') for arch in archlist]

It would be great to fix it completely.

Comment 4 Ondřej Nosek 2019-04-26 13:10:02 UTC
You can try another fix at python3-rpkg-1.57-9.fc31

Comment 5 Petr Pisar 2019-04-29 07:08:14 UTC
The warning has moved:

$ rpm -q python3-rpkg
python3-rpkg-1.57-9.fc31.noarch

$ fedpkg --release f31 lint
/usr/share/rpmlint/Pkg.py:168: UnicodeWarning: decode() called on unicode string, see https://bugzilla.redhat.com/show_bug.cgi?id=1693751
  s.decode('UTF-8')

rpkg code is:

def is_utf8_bytestr(s):
    try:
→       s.decode('UTF-8')
    except UnicodeError:
        return False
    return True

If decode() can recognize the variable contains is a Unicode string and emit the warning, you could you the same recognition method instead of calling decode().

Comment 6 Petr Pisar 2019-04-29 11:41:48 UTC
(In reply to Petr Pisar from comment #5)
> The warning has moved:
> 
> $ rpm -q python3-rpkg
> python3-rpkg-1.57-9.fc31.noarch
> 
> $ fedpkg --release f31 lint
> /usr/share/rpmlint/Pkg.py:168: UnicodeWarning: decode() called on unicode
> string, see https://bugzilla.redhat.com/show_bug.cgi?id=1693751
>   s.decode('UTF-8')
> 
That's rpmlint bug #1699789.