Bug 1699790 - fedpkg lint fails with: Could not execute lint: decoding str is not supported
Summary: fedpkg lint fails with: Could not execute lint: decoding str is not supported
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: rpkg
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: cqi
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-04-15 08:52 UTC by Petr Pisar
Modified: 2019-04-29 11:41 UTC (History)
6 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2019-04-25 08:06:19 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Bugzilla 1693751 0 unspecified CLOSED rpm.labelCompare expects strings, but RPM headers are bytes 2024-06-13 22:05:17 UTC
Red Hat Bugzilla 1699789 0 unspecified CLOSED /usr/share/rpmlint/Pkg.py:168: UnicodeWarning: decode() called on unicode string 2021-02-22 00:41:40 UTC

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.


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