summaryrefslogtreecommitdiff
path: root/meta/classes
diff options
context:
space:
mode:
authorPavel Modilaynen <pavelmn@axis.com>2017-02-24 11:22:20 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-03-01 12:54:23 +0000
commitb26feaf51af55f17fad79dbd53dd3ec0a37c38ff (patch)
treef76e21d2551b34528f325bed4759842abfef4da8 /meta/classes
parent10331f42acfa5dc429198b7c025cc2360511e534 (diff)
downloadopenembedded-core-b26feaf51af55f17fad79dbd53dd3ec0a37c38ff.tar.gz
openembedded-core-b26feaf51af55f17fad79dbd53dd3ec0a37c38ff.tar.bz2
openembedded-core-b26feaf51af55f17fad79dbd53dd3ec0a37c38ff.zip
buildstats.bbclass: Avoid index exception in /proc/PID/io parsing
There is some probability (depends on system load) to get empty or line containing "0" as the last line while reading /proc/PID/io. Avoid build failure by checking if line contains separator ":" before split. Signed-off-by: Pavel Modilaynen <pavelmn@axis.com> Signed-off-by: Daniel Lublin <daniel@lublin.se> Signed-off-by: Ross Burton <ross.burton@intel.com>
Diffstat (limited to 'meta/classes')
-rw-r--r--meta/classes/buildstats.bbclass5
1 files changed, 5 insertions, 0 deletions
diff --git a/meta/classes/buildstats.bbclass b/meta/classes/buildstats.bbclass
index 8d7b5988e3..960653c704 100644
--- a/meta/classes/buildstats.bbclass
+++ b/meta/classes/buildstats.bbclass
@@ -31,6 +31,11 @@ def get_process_cputime(pid):
i = f.readline().strip()
if not i:
break
+ if not ":" in i:
+ # one more extra line is appended (empty or containing "0")
+ # most probably due to race condition in kernel while
+ # updating IO stats
+ break
i = i.split(": ")
iostats[i[0]] = i[1]
resources = resource.getrusage(resource.RUSAGE_SELF)