Merge lp:~jameinel/tarmac/non_ascii-750930 into lp:tarmac
Status: | Superseded |
---|---|
Proposed branch: | lp:~jameinel/tarmac/non_ascii-750930 |
Merge into: | lp:tarmac |
Diff against target: |
37 lines (+19/-0) 2 files modified
tarmac/plugins/command.py (+2/-0) tarmac/plugins/tests/test_command.py (+17/-0) |
To merge this branch: | bzr merge lp:~jameinel/tarmac/non_ascii-750930 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
dobey | Needs Resubmitting | ||
Paul Hummer | Pending | ||
Review via email: mp+73831@code.launchpad.net |
This proposal has been superseded by a proposal from 2013-10-29.
Commit message
Bug #750930, handle non-ascii characters in test output.
Description of the change
This should be a reasonable fix for bug #750930.
I was trying to use Tarmac for lp:meliae, and it seems that gcc likes to put non-ascii characters into the output. (It looks like it uses fancy quotes.) I'm not 100% sure what characters are bad, but I do know that when the test suite failed, Tarmac just dies because of a UnicodeDecodeError.
The test case shows the failure, and the workaround is assuming that stdout/stderr are encoded in UTF-8. It is a slight hack, because the encoding could be something else, but it is unlikely.
At a minimum, it is better to decode w/ UTF-8 than to do u''.join(
This fix was enough for Meliae, though arguably any command that fails should cause Tarmac to say 'could not merge this branch because of FAILURE' rather than dying completely.
I'm not sure how I feel about this. GCC is using the fancy quotes because the locale you're compiling under is en_US.UTF-8 presumably (as you are presumably running this as a live logged-in user). If GCC runs under the C locale, it uses pure ASCII for error/warning messages. And, as you pointed out, this will still fail if under a UTF-8-incompatible locale, such as Russian KOI8-R. I wonder if a better solution might be to force the locale to be C inside tarmac.