Bug 891880 - encode problem in rhnTB.py in spacewalk-backend
Summary: encode problem in rhnTB.py in spacewalk-backend
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Spacewalk
Classification: Community
Component: Server
Version: 1.8
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Michael Mráka
QA Contact: Red Hat Satellite QA List
URL:
Whiteboard:
Depends On:
Blocks: space21
TreeView+ depends on / blocked
 
Reported: 2013-01-04 11:08 UTC by Patrick Emer
Modified: 2014-10-07 09:42 UTC (History)
2 users (show)

Fixed In Version: spacewalk-backend-2.1.29-1
Clone Of:
Environment:
Last Closed: 2014-03-04 13:07:18 UTC
Embargoed:


Attachments (Terms of Use)

Description Patrick Emer 2013-01-04 11:08:44 UTC
Description of problem:
UTF-8 encodeing Problem in python backend  

Version-Release number of selected component (if applicable):
spacewalk-backend-1.8.85-1.el6.noarch

How reproducible:
Use of UTF-8 chars.


Steps to Reproduce:
1. rhn_check on client side
  
Actual results:

[Fri Jan 04 11:48:10 2013] [error] [client XXX ] mod_wsgi (pid=20401): Exception occurred processing WSGI script '/usr/share/rhn/wsgi/xmlrpc.py'.
[Fri Jan 04 11:48:10 2013] [error] [client XXX ] Traceback (most recent call last):
[Fri Jan 04 11:48:10 2013] [error] [client XXX ]   File "/usr/share/rhn/wsgi/xmlrpc.py", line 22, in application
[Fri Jan 04 11:48:10 2013] [error] [client XXX ]     return wsgiHandler.handle(environ, start_response, "xmlrpc", "server.xmlrpc")
[Fri Jan 04 11:48:10 2013] [error] [client XXX ]   File "/usr/share/rhn/wsgi/wsgiHandler.py", line 45, in handle
[Fri Jan 04 11:48:10 2013] [error] [client XXX ]     ret = appServ(req)
[Fri Jan 04 11:48:10 2013] [error] [client XXX ]   File "/usr/lib/python2.6/site-packages/spacewalk/server/apacheHandler.py", line 196, in handler
[Fri Jan 04 11:48:10 2013] [error] [client XXX ]     ret = self._req_processor.process()
[Fri Jan 04 11:48:10 2013] [error] [client XXX ]   File "/usr/lib/python2.6/site-packages/spacewalk/server/apacheRequest.py", line 476, in process
[Fri Jan 04 11:48:10 2013] [error] [client XXX ]     return self.call_function(method, params)
[Fri Jan 04 11:48:10 2013] [error] [client XXX ]   File "/usr/lib/python2.6/site-packages/spacewalk/server/apacheRequest.py", line 174, in call_function
[Fri Jan 04 11:48:10 2013] [error] [client XXX ]     Traceback(method, self.req, severity="unhandled")
[Fri Jan 04 11:48:10 2013] [error] [client XXX ]   File "/usr/lib/python2.6/site-packages/spacewalk/common/rhnTB.py", line 150, in Traceback
[Fri Jan 04 11:48:10 2013] [error] [client XXX ]     ostream.write("%s\\n" % exc.getvalue().encode('utf-8'))
[Fri Jan 04 11:48:10 2013] [error] [client XXX ]   File "/usr/lib64/python2.6/StringIO.py", line 270, in getvalue
[Fri Jan 04 11:48:10 2013] [error] [client XXX ]     self.buf += ''.join(self.buflist)
[Fri Jan 04 11:48:10 2013] [error] [client XXX ] UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 57: ordinal not in range(128)



Expected results:


Additional info:

How to Fix it:

change of Line 150 in /usr/lib/python2.6/site-packages/spacewalk/common/rhnTB.py

- ostream.write("%s\n" % exc.getvalue().encode('utf-8'))
+ ostream.write("%s\n" % unicode(exc.getvalue(),errors='replace'))

for example.

current version:
spacewalk-backend-1.8.85-1.el6.noarch
python-2.6.6-29.el6_3.3.x86_64

Bug in Package:
spacewalk-backend-1.8.85-1.el6.noarch

Comment 1 Ciro Iriarte 2013-08-11 23:02:32 UTC
I see the same error with 1.10, the fix doesn't work though.

After patching:

---
[Sun Aug 11 19:00:18 2013] [error] [client 10.1.30.27] mod_wsgi (pid=1732): Exception occurred processing WSGI script '/usr/share/rhn/wsgi/xmlrpc.py'.
[Sun Aug 11 19:00:18 2013] [error] [client 10.1.30.27] Traceback (most recent call last):
[Sun Aug 11 19:00:18 2013] [error] [client 10.1.30.27]   File "/usr/share/rhn/wsgi/xmlrpc.py", line 22, in application
[Sun Aug 11 19:00:18 2013] [error] [client 10.1.30.27]     return wsgiHandler.handle(environ, start_response, "xmlrpc", "server.xmlrpc")
[Sun Aug 11 19:00:18 2013] [error] [client 10.1.30.27]   File "/usr/share/rhn/wsgi/wsgiHandler.py", line 45, in handle
[Sun Aug 11 19:00:18 2013] [error] [client 10.1.30.27]     ret = appServ(req)
[Sun Aug 11 19:00:18 2013] [error] [client 10.1.30.27]   File "/usr/lib/python2.6/site-packages/spacewalk/server/apacheHandler.py", line 196, in handler
[Sun Aug 11 19:00:18 2013] [error] [client 10.1.30.27]     ret = self._req_processor.process()
[Sun Aug 11 19:00:18 2013] [error] [client 10.1.30.27]   File "/usr/lib/python2.6/site-packages/spacewalk/server/apacheRequest.py", line 486, in process
[Sun Aug 11 19:00:18 2013] [error] [client 10.1.30.27]     return self.call_function(method, params)
[Sun Aug 11 19:00:18 2013] [error] [client 10.1.30.27]   File "/usr/lib/python2.6/site-packages/spacewalk/server/apacheRequest.py", line 175, in call_function
[Sun Aug 11 19:00:18 2013] [error] [client 10.1.30.27]     Traceback(method, self.req, severity="unhandled")
[Sun Aug 11 19:00:18 2013] [error] [client 10.1.30.27]   File "/usr/lib/python2.6/site-packages/spacewalk/common/rhnTB.py", line 151, in Traceback
[Sun Aug 11 19:00:18 2013] [error] [client 10.1.30.27]     ostream.write("%s\\n" % unicode(exc.getvalue(),errors='replace'))
[Sun Aug 11 19:00:18 2013] [error] [client 10.1.30.27]   File "/usr/lib64/python2.6/StringIO.py", line 270, in getvalue
[Sun Aug 11 19:00:18 2013] [error] [client 10.1.30.27]     self.buf += ''.join(self.buflist)
[Sun Aug 11 19:00:18 2013] [error] [client 10.1.30.27] UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 48: ordinal not in range(128)
---

Comment 2 Ciro Iriarte 2013-08-11 23:05:12 UTC
Sorry, this is 2.0 on CentOS6.4!!

Packages:
spacewalk-backend-2.0.3-1.el6.noarch
python-2.6.6-37.el6_4.x86_64

Comment 3 Michael Mráka 2013-10-18 15:51:10 UTC
Fixed in spacewalk master by
commit c75009845c65d9a956238b46f52931c6fd2ae4c4
    891880 - reuse stringutils functions
commit e8628e3b3decc8502f4914d9f60c1d5e1dee3bd6
    891880 - make sure we put strings to fd.write()

Comment 4 Matej Kollar 2014-01-17 12:16:12 UTC
Switching MODIFIED Spacewalk bugs to ON_QA before 2.1 release.

Comment 5 Matej Kollar 2014-03-04 13:07:18 UTC
Spacewalk 2.1 has been released.
https://fedorahosted.org/spacewalk/wiki/ReleaseNotes21

Comment 6 Matej Kollar 2014-03-04 13:08:46 UTC
Spacewalk 2.1 has been released.
https://fedorahosted.org/spacewalk/wiki/ReleaseNotes21


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