From f515420387f04ee9bd19ebf15068f277e51289f7 Mon Sep 17 00:00:00 2001 From: Douglas Raillard <douglas.raillard@arm.com> Date: Mon, 12 Mar 2018 15:50:45 +0000 Subject: [PATCH] cgroups: fix Controller.tasks() Fix cgroups tasks parsing in Controller.tasks() method, to ignore lines that are not formatted properly. --- devlib/module/cgroups.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/devlib/module/cgroups.py b/devlib/module/cgroups.py index b77d7ba..a02b39d 100644 --- a/devlib/module/cgroups.py +++ b/devlib/module/cgroups.py @@ -210,7 +210,15 @@ class Controller(object): entries = output.splitlines() tasks = {} for task in entries: - tid_str, tname, tcmdline = task.split(',', 2) + fields = task.split(',', 2) + nr_fields = len(fields) + if nr_fields < 2: + continue + elif nr_fields == 2: + tid_str, tname = fields + tcmdline = '' + else: + tid_str, tname, tcmdline = fields if not re.search(filter_tid, tid_str): continue