Bug 958038 - rpmlint doesn't handle Unicode encoding errors gracefully
Summary: rpmlint doesn't handle Unicode encoding errors gracefully
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: rpmlint
Version: 6.4
Hardware: Unspecified
OS: Unspecified
Target Milestone: rc
: ---
Assignee: Thomas Woerner
QA Contact: Hubert Kario
Depends On:
Blocks: 971787
TreeView+ depends on / blocked
Reported: 2013-04-30 08:29 UTC by Hubert Kario
Modified: 2013-07-18 23:10 UTC (History)
2 users (show)

Fixed In Version: rpmlint-0.94-3.1.el6
Doc Type: Bug Fix
Doc Text:
When a package had a UTF-8 encoding error in the description, or the description was encoded in a different character set, then rpmlint terminated unexpectedly with a segmentation fault. With this update, rmplint returns an error message that the description has incorrectly encoded UTF-8 data (tag-not-utf8 error), and crashes no longer occur in the described scenario.
Clone Of:
: 971787 (view as bug list)
Last Closed: 2013-06-17 07:33:38 UTC

Attachments (Terms of Use)
Proposed patch (628 bytes, patch)
2013-06-06 20:38 UTC, Thomas Woerner
no flags Details | Diff
spec file that doesn't cause the crash in rpmlint (1.80 KB, text/plain)
2013-06-07 09:07 UTC, Hubert Kario
no flags Details
spec file that does cause crash in rpmlint (1.66 KB, text/x-rpm-spec)
2013-06-07 09:08 UTC, Hubert Kario
no flags Details

System ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2013:0948 normal SHIPPED_LIVE rpmlint bug fix update 2013-06-17 11:33:13 UTC

Description Hubert Kario 2013-04-30 08:29:06 UTC
Description of problem:
When a package has a UTF-8 encoding error in description (or description encoded in some other charset) rpmlint crashes.

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1. Create a spec file having characters from other charset in description (e.g. using "echo Łódź | iconv -f utf8 -t cp1250 >> package.spec")
2. Build a package using rpmbuild -ba
3. run "rpmlint -i package.rpm"
Actual results:
rpmlint-test-tag-not-utf8.noarch: W: spelling-error %description -l en_US utf -> fut, Ute, Utah
The value of this tag appears to be misspelled. Please double-check.

0 packages and 0 specfiles checked; 0 errors, 2 warnings.
Traceback (most recent call last):
  File "/usr/share/rpmlint/rpmlint.py", line 352, in <module>
  File "/usr/share/rpmlint/rpmlint.py", line 158, in main
  File "/usr/share/rpmlint/rpmlint.py", line 218, in runChecks
  File "/usr/share/rpmlint/TagsCheck.py", line 650, in check
    self.check_description(pkg, lang, ignored_words)
  File "/usr/share/rpmlint/TagsCheck.py", line 805, in check_description
    spell_check(pkg, utf8desc, '%%description -l %s', lang, ignored_words)
  File "/usr/share/rpmlint/TagsCheck.py", line 473, in spell_check
    printWarning(pkg, 'spelling-error', fmt % lang, err.word, sug)
  File "/usr/share/rpmlint/Filter.py", line 28, in printWarning
    _print("W", pkg, reason, details)
  File "/usr/share/rpmlint/Filter.py", line 63, in _print
    print (s)
UnicodeEncodeError: 'ascii' codec can't encode character u'\xf3' in position 74: ordinal not in range(128)

Expected results:
Error message that the description has wrongly encoded utf-8 data (tag-not-utf8 error)

Additional info:

Comment 5 Hubert Kario 2013-05-27 13:26:24 UTC
the 'rpmlint' command must be run in non unicode enabled environment:


# stop unicode
kbd_mode -a
if test -t ; then
        printf '\033%%@'
stty -iutf8

uid="`id -u 2>/dev/null`" ||:
if [ "$uid" = '0' ]; then
        [ ! -r "$HOME/.kbd/.keymap_sv" ] ||
                loadkeys "$HOME/.kbd/.keymap_sv"

in regular interactive shell from Fedora/RHEL it won't crash

Comment 6 Thomas Woerner 2013-06-06 20:38:33 UTC
Created attachment 757918 [details]
Proposed patch

This patch fixes the symptom.

The origin of the problem is that unicode is deactivated in the test envirnoment.

Comment 7 Hubert Kario 2013-06-07 09:07:29 UTC
Created attachment 758063 [details]
spec file that doesn't cause the crash in rpmlint

Comment 8 Hubert Kario 2013-06-07 09:08:45 UTC
Created attachment 758065 [details]
spec file that does cause crash in rpmlint

when rpmlint is run in non unicode enabled terminal, this spec file causes it to crash

Comment 13 errata-xmlrpc 2013-06-17 07:33:38 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.


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