[OE-core] [PATCH V2 6/9] core/target/ssh.py: replace decode errors

Robert Yang liezhi.yang at windriver.com
Thu Aug 24 06:19:48 UTC 2017



On 08/23/2017 09:17 PM, Richard Purdie wrote:
> On Tue, 2017-08-22 at 22:55 +1200, Paul Eggleton wrote:
>> On Tuesday, 22 August 2017 1:23:10 PM NZST Robert Yang wrote:
>>>
>>> There might be wild strings when read from target (especially when
>>> reading ptest results), replace the errors to avoid breaking the
>>> test.
>>>
>>> Fixed: (Not always happen)
>>> $ bitbake core-image-sato -ctestimage
>>> [snip]
>>>     status, output = self.target.run('ptest-runner', 0)
>>>   File "/buildarea/lyang1/poky/meta/lib/oeqa/core/target/ssh.py",
>>> line 84, in run
>>>     status, output = self._run(sshCmd, processTimeout, True)
>>>   File "/buildarea/lyang1/poky/meta/lib/oeqa/core/target/ssh.py",
>>> line 55, in _run
>>>     status, output = SSHCall(command, self.logger, timeout)
>>>   File "/buildarea/lyang1/poky/meta/lib/oeqa/core/target/ssh.py",
>>> line 258, in SSHCall
>>>     run()
>>>   File "/buildarea/lyang1/poky/meta/lib/oeqa/core/target/ssh.py",
>>> line 236, in run
>>>     output = process.communicate()[0].decode("utf-8")
>>> UnicodeDecodeError: 'utf-8' codec can't decode byte 0xc3 in
>>> position 4906: invalid continuation byte
>>>
>>> [YOCTO #11547]
>>>
>>> Signed-off-by: Robert Yang <liezhi.yang at windriver.com>
>>> ---
>>>  meta/lib/oeqa/core/target/ssh.py | 4 ++--
>>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/meta/lib/oeqa/core/target/ssh.py
>>> b/meta/lib/oeqa/core/target/ssh.py
>>> index b80939c..a2eafcd 100644
>>> --- a/meta/lib/oeqa/core/target/ssh.py
>>> +++ b/meta/lib/oeqa/core/target/ssh.py
>>> @@ -211,7 +211,7 @@ def SSHCall(command, logger, timeout=None,
>>> **opts):
>>>                              process.stdout.close()
>>>                              eof = True
>>>                          else:
>>> -                            data = data.decode("utf-8")
>>> +                            data = data.decode("utf-8",
>>> errors='replace')
>>>                              output += data
>>>                              logger.debug('Partial data from SSH
>>> call: %s' % data)
>> Since we're dealing with partial data here, shouldn't we be using a
>> reader object? e.g.:
>>
>>   http://git.yoctoproject.org/cgit/cgit.cgi/poky/commit/?id=bfd8c35c3
>> f917e3806c8dfe36c98c70fbccbb3c9
>
>
> I've decided to merge this series as it improves the ptest support
> substantially however I am expecting a follow up with the tweaks Paul
> suggests here please.

Thanks, sent:
[OE-core] [PATCH 0/1] core/target/ssh.py: use reader to handle partial data

// Robert

>
> Cheers,
>
> Richard
>
>



More information about the Openembedded-core mailing list