[U-Boot] [PATCH] buildman: Translate more strings to latin-1

Daniel Schwierzeck daniel.schwierzeck at gmail.com
Fri Jun 2 09:18:27 UTC 2017



Am 01.06.2017 um 15:21 schrieb Simon Glass:
> Hi Daniel,
> 
> On 31 May 2017 at 07:40, Daniel Schwierzeck
> <daniel.schwierzeck at gmail.com> wrote:
>> This is a follow-up patch for commit fbeb33752999e7317113199ef89873d6b6916814.
>>
>> This fixes following exception:
>>
>> Exception in thread Thread-7:
>> Traceback (most recent call last):
>>   File "/usr/lib/python2.7/threading.py", line 801, in __bootstrap_inner
>>     self.run()
>>   File "/u-boot/tools/buildman/builderthread.py", line 475, in run
>>     self.RunJob(job)
>>   File "/u-boot/tools/buildman/builderthread.py", line 456, in RunJob
>>     self._WriteResult(result, job.keep_outputs)
>>   File "/u-boot/tools/buildman/builderthread.py", line 333, in _WriteResult
>>     print >>fd, dump_result.stdout,
>> UnicodeEncodeError: 'ascii' codec can't encode characters in position 75-76: ordinal not in range(128)
>>
>> Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck at gmail.com>
>>
>> ---
>>
>>  tools/buildman/builderthread.py | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/tools/buildman/builderthread.py b/tools/buildman/builderthread.py
>> index acaf5007f5..0a460878f3 100644
>> --- a/tools/buildman/builderthread.py
>> +++ b/tools/buildman/builderthread.py
>> @@ -330,7 +330,7 @@ class BuilderThread(threading.Thread):
>>                      objdump = self.builder.GetObjdumpFile(result.commit_upto,
>>                                      result.brd.target, fname)
>>                      with open(objdump, 'w') as fd:
>> -                        print >>fd, dump_result.stdout,
>> +                        print >>fd, dump_result.stdout.encode('latin-1', 'ignore'),
> 
> I am worried that this will produce gibberish in the output. Do you
> know what specific characters are causing problems? Can we encode to
> utf-8? BTW I recently sent a patman series to try to resolve unicode
> issues in patman.
> 

objdump uses localized output. If I use LC_ALL=C, the exception doesn't
occur. My system's default language is German. Thus the offending
character is the German 'ö':

...
Sektionen:
Idx Name          Größe     VMA       LMA       Datei-Off Ausr.
  0 .text         00032a94  9f000000  9f000000  000000c0  2**4
                  CONTENTS, ALLOC, LOAD, CODE
  1 .rodata       00008e50  9f032aa0  9f032aa0  00032b60  2**4
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
...

Actually I'd chosen UTF-8 too, but I followed Tom's patch which used
latin-1 ;)

So we should always encode the output of tools such as binutils to
UTF-8, shouldn't we? I can send an updated patch.

-- 
- Daniel

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170602/a9d58869/attachment.sig>


More information about the U-Boot mailing list