summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorMichael Wood <michael.g.wood@intel.com>2015-02-03 14:20:12 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-02-03 14:30:55 +0000
commitbd84192866af85c6ef8a5653547c67bb813f14a4 (patch)
tree45f2de45007c991ca3ec83bd23fd9ceaa3b6e8cd /meta
parent013f7e286d72c51b52a72fdbff6cbc875b3a15ac (diff)
downloadast2050-yocto-poky-bd84192866af85c6ef8a5653547c67bb813f14a4.zip
ast2050-yocto-poky-bd84192866af85c6ef8a5653547c67bb813f14a4.tar.gz
report-error: Catch un-readable log data
If a log data cannot be decoded to utf-8 or read then handle this gracefully. This can happen if a log file contains binary or something goes wrong with the file open process. (From OE-Core rev: 787ffc5e12f1639aa5e0917bb23deced53a0478e) Signed-off-by: Michael Wood <michael.g.wood@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r--meta/classes/report-error.bbclass10
1 files changed, 7 insertions, 3 deletions
diff --git a/meta/classes/report-error.bbclass b/meta/classes/report-error.bbclass
index 8b30422..5f155e3 100644
--- a/meta/classes/report-error.bbclass
+++ b/meta/classes/report-error.bbclass
@@ -47,9 +47,13 @@ python errorreport_handler () {
taskdata['package'] = e.data.expand("${PF}")
taskdata['task'] = task
if log:
- logFile = open(log, 'r')
- taskdata['log'] = logFile.read()
- logFile.close()
+ try:
+ logFile = open(log, 'r')
+ taskdata['log'] = logFile.read().decode('utf-8')
+ logFile.close()
+ except:
+ taskdata['log'] = "Unable to read log file"
+
else:
taskdata['log'] = "No Log"
jsondata = json.loads(errorreport_getdata(e))
OpenPOWER on IntegriCloud