diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2019-05-01 08:00:00 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2019-05-01 23:10:52 +0100 |
commit | ec3c2d46504256afb8b0ea59d2ab67ae3887db1b (patch) | |
tree | 906fb61f4cd45806c2cef760b9e802f029946752 /meta/lib/oeqa | |
parent | a85601aae19edf8db729a9d18ef1672fc6e95e98 (diff) | |
download | poky-ec3c2d46504256afb8b0ea59d2ab67ae3887db1b.tar.gz |
oeqa/ssh: Avoid unicode decode exceptions
This code really needs to be rewritten to not split potential
multibyte characters, for now work around it to avoid exceptions like:
File "/home/pokybuild/yocto-worker/qa-extras2/build/meta/lib/oeqa/core/target/ssh.py", line 211, in run
data = reader.read(1024, 4096)
File "/usr/lib64/python3.6/codecs.py", line 503, in read
newchars, decodedbytes = self.decode(data, self.errors)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x92 in position 0: invalid start byte
(From OE-Core rev: 17e87510378f2729208a8262695f28e1efe5eb4c)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oeqa')
-rw-r--r-- | meta/lib/oeqa/core/target/ssh.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/meta/lib/oeqa/core/target/ssh.py b/meta/lib/oeqa/core/target/ssh.py index 8ff1f6c677..2adbb3000c 100644 --- a/meta/lib/oeqa/core/target/ssh.py +++ b/meta/lib/oeqa/core/target/ssh.py | |||
@@ -207,7 +207,7 @@ def SSHCall(command, logger, timeout=None, **opts): | |||
207 | logger.debug('time: %s, endtime: %s' % (time.time(), endtime)) | 207 | logger.debug('time: %s, endtime: %s' % (time.time(), endtime)) |
208 | try: | 208 | try: |
209 | if select.select([process.stdout], [], [], 5)[0] != []: | 209 | if select.select([process.stdout], [], [], 5)[0] != []: |
210 | reader = codecs.getreader('utf-8')(process.stdout) | 210 | reader = codecs.getreader('utf-8')(process.stdout, 'surrogatepass') |
211 | data = reader.read(1024, 4096) | 211 | data = reader.read(1024, 4096) |
212 | if not data: | 212 | if not data: |
213 | process.stdout.close() | 213 | process.stdout.close() |
@@ -234,7 +234,7 @@ def SSHCall(command, logger, timeout=None, **opts): | |||
234 | output += lastline | 234 | output += lastline |
235 | 235 | ||
236 | else: | 236 | else: |
237 | output = process.communicate()[0].decode("utf-8", errors='replace') | 237 | output = process.communicate()[0].decode("utf-8", errors='surrogatepass') |
238 | logger.debug('Data from SSH call: %s' % output.rstrip()) | 238 | logger.debug('Data from SSH call: %s' % output.rstrip()) |
239 | 239 | ||
240 | options = { | 240 | options = { |