Package: dstat / 0.7.4-6

top_int_plugin_852927 Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
Description: avoid crashing in top-int plugin
 The first intset can have less elements than the second one. Catch IndexError
 to avoid crashing if that is the case.
Author: Emanuele Rocca <ema@debian.org>
Bug-Debian: https://bugs.debian.org/852927
Last-Update: 2019-07-29

diff --git a/plugins/dstat_top_int.py b/plugins/dstat_top_int.py
index f0a9fb1..99d6f3d 100644
--- a/plugins/dstat_top_int.py
+++ b/plugins/dstat_top_int.py
@@ -41,7 +41,10 @@ class dstat_plugin(dstat):
             self.intset1 = [ 0 for i in self.intset2 ]
 
         for i in range(len(self.intset2)):
-            total = (self.intset2[i] - self.intset1[i]) * 1.0 / elapsed
+            try:
+                total = (self.intset2[i] - self.intset1[i]) * 1.0 / elapsed
+            except IndexError:
+                continue
 
             ### Put the highest value in self.val
             if total > self.val['total']: