diff options
author | Yanichkin Alexander <Alexander_Sergey@mail.ru> | 2021-10-08 09:25:31 +0800 |
---|---|---|
committer | Paul Wise <pabs3@bonedaddy.net> | 2021-10-08 09:32:28 +0800 |
commit | 443737ec620a699286b9b2e44dbcaac53f553812 (patch) | |
tree | 7563dedff725b5b1913604e7f04f14a23f2ffbb4 | |
parent | ab35334d374e588bec12d201fb8869c536f0545d (diff) | |
download | iotop-443737ec620a699286b9b2e44dbcaac53f553812.tar.gz |
Workaround crashes due to non-UTF-8 characters in process command-lines
Use the Python feature of replacing non-UTF-8 characters
with the U+FFFD REPLACEMENT CHARACTER (�).
This is only a workaround, a more useful action would be to guess the
encoding using chardet or similar and coerce the bytes into Unicode.
Fixes: https://bugs.launchpad.net/ubuntu/+source/iotop/+bug/1932523
Fixes: https://bugs.debian.org/737043
-rw-r--r-- | iotop/data.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/iotop/data.py b/iotop/data.py index 5d70e29..f5496d0 100644 --- a/iotop/data.py +++ b/iotop/data.py @@ -207,7 +207,7 @@ def find_uids(options): def parse_proc_pid_status(pid): result_dict = {} try: - for line in open('/proc/%d/status' % pid): + for line in open('/proc/%d/status' % pid, errors='replace'): try: key, value = line.split(':', 1) except ValueError: |