Bug 442877 - repo-rss fails on unicode char in package changelog
repo-rss fails on unicode char in package changelog
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: yum-utils (Show other bugs)
All Linux
low Severity low
: rc
: ---
Assigned To: James Antill
James Antill
Depends On:
  Show dependency treegraph
Reported: 2008-04-17 07:15 EDT by Jan Hutař
Modified: 2013-03-15 16:05 EDT (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2013-03-15 16:05:21 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

External Trackers
Tracker ID Priority Status Summary Last Updated
CentOS 4025 None None None Never

  None (edit)
Description Jan Hutař 2008-04-17 07:15:41 EDT
Description of problem:
When I call repo-rss on repo with package which have unicode char in changelog, 
I got this traceback:

Traceback (most recent call last):
  File "/usr/bin/repo-rss", line 280, in ?
    main(options, args)
  File "/usr/bin/repo-rss", line 249, in main
    makeFeed(options.filename, options.title, options.link, 
options.description, recent, my)
  File "/usr/bin/repo-rss", line 177, in makeFeed
    rssobj.doPkg(pkg, url)
  File "/usr/bin/repo-rss", line 107, in doPkg
    item = self.rsspkg(pkg, url)
  File "/usr/bin/repo-rss", line 149, in rsspkg
    description += escape('<pre>%s</pre>' % escape(changelog.encode('utf-8')))
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 344: 
ordinal not in range(128)

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

How reproducible:

Steps to Reproduce:
1. repo-rss -l http://www.example.com -d "Most recent packages" -r 15

Actual results:

Expected results:
RSS generated

Additional info:
repo-rss fails on iproute-2.6.18-6.el5 package while triing to encode it's 
changelog which is (note "á" at 344):

Tue, 08 Apr 2008 GMT - Marcela Maslanova <mmaslano@redhat.com> - 2.6.18-6
- [iPv6DoD] fix RFC 4309 Using AES CCM Mode with IPsec ESP
- Resolves: rhbz#441384

Thu, 20 Mar 2008 GMT - Marcela Maslanova <mmaslano@redhat.com> - 2.6.18-5
- Request for IPSec initial ESP sequence number offset
- Resolves: rhbz#253054

Tue, 19 Dec 2006 GMT - Radek Vokál <rvokal@redhat.com> - 2.6.18-4
- fix output of ip route command
- Resolves: #220150
Comment 1 James Antill 2008-04-17 14:29:17 EDT
 That .encode() is assuming changelog is unicode, when it's not. Something like:

 if isinstance(changelog, unicode):
     changelog = changelog.encode('utf-8')
 description += escape('<pre>%s</pre>' % escape(changelog))

...will probably fix it, for all cases.

 But we've done _lots_ of changes upstream to fix/workaround this kind of crack
in python, so I'd like to get some non-trivial amount of testing on the fix.
Comment 2 Tru Huynh 2009-12-06 12:43:33 EST
proposed fix from CentOS
Comment 3 Mikolaj Kucharski 2009-12-10 20:03:17 EST
Would be possible to incorporate proposed fix from CentOS to RHEL?
Comment 4 Mikolaj Kucharski 2010-03-04 21:08:36 EST
Hi, Any updates on this ticket?
Comment 5 Mikolaj Kucharski 2010-04-16 21:27:58 EDT
Problem still present in RHEL 5.5

# rpm -qf `which repoquery` /usr/lib64/python2.4/codecs.py

# repoquery -qal > /dev/null
Traceback (most recent call last):
  File "/usr/bin/repoquery", line 850, in ?
  File "/usr/bin/repoquery", line 846, in main
  File "/usr/bin/repoquery", line 497, in runQuery
    print pkg.doQuery(oper)
  File "/usr/lib64/python2.4/codecs.py", line 178, in write
    data, consumed = self.encode(object, self.errors)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 190: ordinal not in range(128)

# rpm -qf /etc/issue
Comment 6 Mikolaj Kucharski 2011-03-09 09:09:57 EST
Any news here? Fix from CentOS bug number 4025 fixes the issue.
Comment 7 James Antill 2011-03-09 11:00:42 EST
The patch posted to CentOS is:

diff -uNr yum-utils-1.1.18/repoquery.py yum-utils-1.1.21/repoquery.py

...so just a rebase to a much newer upstream.
Comment 8 James Antill 2011-03-09 11:28:35 EST
Also, this ticket was opened against repo-rss not repoquery.
Comment 9 James Antill 2013-03-15 16:05:21 EDT
This request was evaluated by Red Hat Engineering for inclusion in a Red 
Hat Enterprise Linux maintenance release.

Red Hat does not currently plan to provide this change in a Red Hat 
Enterprise Linux update release for currently deployed products.

With the goal of minimizing risk of change for deployed systems, and in 
response to customer and partner requirements, Red Hat takes a 
conservative approach when evaluating enhancements for inclusion in 
maintenance updates for currently deployed products. The primary 
objectives of update releases are to enable new hardware platform 
support and to resolve critical defects.

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