aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPavel Modilaynen <pavelmn@axis.com>2017-02-24 11:22:20 +0100
committerMartin Jansa <Martin.Jansa@gmail.com>2018-01-31 19:10:17 +0000
commit5520408fb3ad75f96fca0e4baeaccc8319586bce (patch)
tree9ea82e551143ab4a4c3bc5035d864b22ef06085f
parent39fd8c129e2bff7f2f1649b7f6e036ccc50fd5d8 (diff)
downloadopenembedded-core-contrib-jansa/morty-backports.zip
openembedded-core-contrib-jansa/morty-backports.tar.gz
openembedded-core-contrib-jansa/morty-backports.tar.bz2
buildstats.bbclass: Avoid index exception in /proc/PID/io parsingjansa/morty-backports
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. Backport from pyro commit b26feaf51af55f17fad79dbd53dd3ec0a37c38ff 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> Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
-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 599a219..415d2ee 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)