diff --git a/0016-Workaround-crashes-due-to-non-UTF-8-characters-in-pr.patch b/0016-Workaround-crashes-due-to-non-UTF-8-characters-in-pr.patch new file mode 100644 index 0000000..28f9497 --- /dev/null +++ b/0016-Workaround-crashes-due-to-non-UTF-8-characters-in-pr.patch @@ -0,0 +1,40 @@ +From 443737ec620a699286b9b2e44dbcaac53f553812 Mon Sep 17 00:00:00 2001 +From: Yanichkin Alexander +Date: Fri, 8 Oct 2021 09:25:31 +0800 +Subject: [PATCH] Workaround crashes due to non-UTF-8 characters in process + command-lines +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +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 + +Conflict: NA +Reference: https://repo.or.cz/iotop.git/commit/443737ec620a699286b9b2e44dbcaac53f553812 +--- + iotop/data.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +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: +-- +2.33.0 + diff --git a/0017-data.py-get_cmdline-use-errors-replace-for-unicode-e.patch b/0017-data.py-get_cmdline-use-errors-replace-for-unicode-e.patch new file mode 100644 index 0000000..1a4cd13 --- /dev/null +++ b/0017-data.py-get_cmdline-use-errors-replace-for-unicode-e.patch @@ -0,0 +1,32 @@ +From 4b2e1aa2464cfc4a29c9565c9e143b52ef8e4848 Mon Sep 17 00:00:00 2001 +From: Dominique Martinet +Date: Mon, 3 Apr 2023 18:09:29 +0900 +Subject: [PATCH] data.py get_cmdline: use errors=replace for unicode errors + +/proc/pid/cmdline is user-controlled and not necessarily valid unicode, +just replace bogus characters like already done for /proc/pid/status. + +See-also: commit 443737ec620a699286b9b2e44dbcaac53f553812 + +Conflict: NA +Reference: https://repo.or.cz/iotop.git/commit/4b2e1aa2464cfc4a29c9565c9e143b52ef8e4848 +--- + iotop/data.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/iotop/data.py b/iotop/data.py +index f5496d0..8c1acae 100644 +--- a/iotop/data.py ++++ b/iotop/data.py +@@ -307,7 +307,7 @@ class ProcessInfo(DumpableObject): + def get_cmdline(self): + # A process may exec, so we must always reread its cmdline + try: +- proc_cmdline = open('/proc/%d/cmdline' % self.pid) ++ proc_cmdline = open('/proc/%d/cmdline' % self.pid, errors='replace') + cmdline = proc_cmdline.read(4096) + except IOError: + return '{no such process}' +-- +2.33.0 + diff --git a/iotop.spec b/iotop.spec index 829fe4c..4ccb866 100644 --- a/iotop.spec +++ b/iotop.spec @@ -1,6 +1,6 @@ Name: iotop Version: 0.6 -Release: 27 +Release: 28 Summary: Simple top-like I/O monitor License: GPLv2+ URL: http://guichaz.free.fr/iotop/ @@ -25,6 +25,8 @@ Patch12: 0012-riscv-Add-riscv64-support.patch Patch13: 0013-loongarch64-add-loongarch64-support.patch Patch14: 0014-Hide-UI-elements-on-smaller-terminals.patch Patch15: 0015-Check-the-column-title-is-not-empty-before-using-it.patch +Patch16: 0016-Workaround-crashes-due-to-non-UTF-8-characters-in-pr.patch +Patch17: 0017-data.py-get_cmdline-use-errors-replace-for-unicode-e.patch %description iotop watches I/O usage information output by the Linux kernel (requires 2.6.20 or later) and @@ -62,6 +64,9 @@ This contains man files for the using of iotop %{_mandir}/man8/iotop.* %changelog +* Tue Dec 17 2024 lvyy - 0.6-28 +- Fix the iotop crash caused by non-UTF-8 characters + * Tue Nov 19 2024 lvyy -0.6-27 - Fix crash when hide UI elements on smaller terminals