Bug 1112667

Summary: Exception each time running the tool
Product: [Fedora] Fedora Reporter: Jaroslav Škarvada <jskarvad>
Component: fedora-reviewAssignee: Stanislav Ochotnicky <sochotni>
Status: CLOSED UPSTREAM QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 20CC: leamas.alec, mcepl, mcepl, mmaslano, pingou, sochotni, volker27
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-04-16 17:43:37 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Jaroslav Škarvada 2014-06-24 12:48:46 UTC
Description of problem:
Each time running the tool I get the following:

ERROR: Exception down the road...(logs in /home/yarda/.cache/fedora-review.log)

And in the log there is the following traceback:
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/FedoraReview/review_helper.py", line 232, in run
    self._do_run(outfile)
  File "/usr/lib/python2.7/site-packages/FedoraReview/review_helper.py", line 222, in _do_run
    self._do_report(outfile)
  File "/usr/lib/python2.7/site-packages/FedoraReview/review_helper.py", line 96, in _do_report
    self._run_checks(self.bug.spec_file, self.bug.srpm_file, outfile)
  File "/usr/lib/python2.7/site-packages/FedoraReview/review_helper.py", line 115, in _run_checks
    writedown=not Settings.no_report)
  File "/usr/lib/python2.7/site-packages/FedoraReview/checks.py", line 386, in run_checks
    write_xml_report(self.spec, results)
  File "/usr/lib/python2.7/site-packages/FedoraReview/reports.py", line 189, in write_xml_report
    dom = xml.dom.minidom.parseString(ET.tostring(root))
  File "/usr/lib64/python2.7/xml/etree/ElementTree.py", line 1126, in tostring
    ElementTree(element).write(file, encoding, method=method)
  File "/usr/lib64/python2.7/xml/etree/ElementTree.py", line 820, in write
    serialize(write, self._root, encoding, qnames, namespaces)
  File "/usr/lib64/python2.7/xml/etree/ElementTree.py", line 939, in _serialize_xml
    _serialize_xml(write, e, encoding, qnames, None)
  File "/usr/lib64/python2.7/xml/etree/ElementTree.py", line 939, in _serialize_xml
    _serialize_xml(write, e, encoding, qnames, None)
  File "/usr/lib64/python2.7/xml/etree/ElementTree.py", line 939, in _serialize_xml
    _serialize_xml(write, e, encoding, qnames, None)
  File "/usr/lib64/python2.7/xml/etree/ElementTree.py", line 937, in _serialize_xml
    write(_escape_cdata(text, encoding))
  File "/usr/lib64/python2.7/xml/etree/ElementTree.py", line 1073, in _escape_cdata
    return text.encode(encoding, "xmlcharrefreplace")
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc5 in position 27: ordinal not in range(128)


Version-Release number of selected component (if applicable):
fedora-review-0.5.1-2.fc20.noarch

How reproducible:
Always

Steps to Reproduce:
1. fedora-review -b 1111602

Actual results:
Exception

Expected results:
No exception

Additional info:
It seems to be caused by my $HOME/.rpmmacros containing UTF-8 character, i.e. the following snip:
%packager Jaroslav Škarvada <jskarvad>

This didn't happen (several months ago).

So actually there are two bugs:
1. the fedora-review code should cope with UTF-8
2. the tool output shouldn't depend on user settings / macros

I reported the 2. in the past, but it seems the bug was closed. To overcome the 2., the tool should be run in the chroot, or at least in some special directory with its own HOME, i.e. the following workaround wrapper should work:

pushd `mktemp -d`
HOME=`pwd` fedora-review $@
popd

Comment 1 Volker Fröhlich 2014-07-02 19:51:22 UTC
I confirm the reason being non-ASCII characters in $HOME/.rpmmacros.

Comment 2 Marcela Mašláňová 2014-09-23 14:21:12 UTC
*** Bug 1145673 has been marked as a duplicate of this bug. ***

Comment 3 Matěj Cepl 2014-09-25 08:01:57 UTC
Yeah, Matěj -> Matej helped. But that's bad ... I like my name.

Comment 4 Alec Leamas 2014-10-14 12:13:05 UTC
Well, f-r review is certainly not supposed to enforce silly US usernames. If you could provide a testcase, I can have a look at this mischief.

Comment 5 Jaroslav Škarvada 2014-10-14 12:46:30 UTC
(In reply to Alec Leamas from comment #4)
> Well, f-r review is certainly not supposed to enforce silly US usernames. If
> you could provide a testcase, I can have a look at this mischief.

Thanks, one possible reproducer:
echo '%packager Jaroslav Škarvada <jskarvad>' > ~/.rpmmacros
fedora-review -b 1150653

Comment 6 Matěj Cepl 2014-10-14 14:43:51 UTC
(In reply to Alec Leamas from comment #4)
> Well, f-r review is certainly not supposed to enforce silly US usernames. If
> you could provide a testcase, I can have a look at this mischief.

Take a look at names of Jaroslav Škvarvada, Matěj Cepl, and Marcela Mašláňová :)

Comment 7 Alec Leamas 2015-04-16 17:43:37 UTC
Forgot this :( Now fixed in 
https://fedorahosted.org/FedoraReview/changeset/3115a4bf23d330