Bug 1722868 - rpmlint broken in Rawhide: AttributeError: 'str' object has no attribute 'decode'
Summary: rpmlint broken in Rawhide: AttributeError: 'str' object has no attribute 'dec...
Keywords:
Status: ON_QA
Alias: None
Product: Fedora
Classification: Fedora
Component: rpmlint
Version: 31
Hardware: All
OS: Linux
unspecified
high
Target Milestone: ---
Assignee: Tom "spot" Callaway
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
: 1693760 (view as bug list)
Depends On:
Blocks: 1693751 1779194 1718430
TreeView+ depends on / blocked
 
Reported: 2019-06-21 14:23 UTC by Jerry James
Modified: 2020-06-03 02:57 UTC (History)
7 users (show)

Fixed In Version: rpmlint-1.11-1.fc31
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed:
Type: Bug


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
Github rpm-software-management rpmlint issues 202 None closed decode('UTF-8') is not correct. 2020-05-14 09:12:25 UTC

Description Jerry James 2019-06-21 14:23:27 UTC
Description of problem:
After last night's Rawhide compose, rpmlint is now completely broken.  All invocations of it result in only this output:

Traceback (most recent call last):
  File "/usr/bin/rpmlint", line 381, in <module>
    main()
  File "/usr/bin/rpmlint", line 169, in main
    runChecks(pkg)
  File "/usr/bin/rpmlint", line 226, in runChecks
    check.check(pkg)
  File "/usr/share/rpmlint/TagsCheck.py", line 695, in check
    self.check_summary(pkg, lang, ignored_words)
  File "/usr/share/rpmlint/TagsCheck.py", line 903, in check_summary
    if not Pkg.is_utf8_bytestr(summary):
  File "/usr/share/rpmlint/Pkg.py", line 168, in is_utf8_bytestr
    s.decode('UTF-8')
AttributeError: 'str' object has no attribute 'decode'

Version-Release number of selected component (if applicable):
rpmlint-1.10-22.fc31.noarch

How reproducible:
Always

Steps to Reproduce:
1. Run rpmlint on anything
2.
3.

Actual results:
An AttributeError is thrown.

Expected results:
Useful output.

Additional info:

Comment 1 Jerry James 2019-06-21 14:54:31 UTC
This is the definition of is_utf8_bytestr, at line 166 of /usr/share/rpmlint/Pkg.py:

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

This crude change to the function is probably not the right fix for the issue, but does allow me to do useful work with rpmlint again:

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

Comment 2 Tom "spot" Callaway 2019-06-21 14:57:58 UTC
The fix is a bit more complicated than that, see the upstream bug I attached to this bz.

Comment 3 Petr Pisar 2019-07-01 08:48:02 UTC
*** Bug 1693760 has been marked as a duplicate of this bug. ***

Comment 4 Miro Hrončok 2019-07-03 23:23:33 UTC
This should fix it: https://src.fedoraproject.org/rpms/rpmlint/pull-request/8

Comment 5 Miro Hrončok 2019-07-10 22:52:58 UTC
Try rpmlint-1.11-1.fc31.

However note that we are figuring more and more problematic places in the codebase that fail. Trying to lint an RPM with non-UTF-8 data in headers will most likely crash it.

Comment 6 Petr Pisar 2019-07-11 09:48:43 UTC
I confirm rpmlint-1.11-1.fc31.noarch works for me.

How could a Fedora's RPM package contain non-UTF-8 data when guidelines state the UTF-8 is mandatory :)

Comment 7 Miro Hrončok 2019-07-11 09:54:18 UTC
(In reply to Petr Pisar from comment #6)
> How could a Fedora's RPM package contain non-UTF-8 data when guidelines
> state the UTF-8 is mandatory :)

Exactly!

Comment 8 Jerry James 2019-07-12 22:05:43 UTC
Ahhh, much better; rpmlint-1.11-2.fc31.noarch works for me.  Thank you!

Comment 9 Ben Cotton 2019-08-13 16:49:11 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 31 development cycle.
Changing version to '31'.

Comment 10 Fedora Admin user for bugzilla script actions 2020-06-03 02:57:06 UTC
This package has changed maintainer in the Fedora.
Reassigning to the new maintainer of this component.


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