Compare commits

...

10 Commits

Author SHA1 Message Date
openeuler-ci-bot
172972d309
!59 [sync] PR-57: Fix the iotop crash caused by non-UTF-8 characters
From: @openeuler-sync-bot 
Reviewed-by: @swf504 
Signed-off-by: @swf504
2024-12-17 07:42:56 +00:00
lvyy
9cc98cf879 Fix the iotop crash caused by non-UTF-8 characters
(cherry picked from commit 734821f837f5afee9a93d175f7e7d1404cf2045b)
2024-12-17 15:04:17 +08:00
openeuler-ci-bot
60653d286d
!49 [sync] PR-42: Fix crash when hide UI elements on smaller terminals
From: @openeuler-sync-bot 
Reviewed-by: @swf504 
Signed-off-by: @swf504
2024-11-26 01:11:10 +00:00
lvyy
e58616579c Hide UI elements on smaller terminals
(cherry picked from commit 14fd92ddf1692a98aa904b649b1038ebf10a068c)
2024-11-25 15:57:52 +08:00
openeuler-ci-bot
7430615928
!32 [sync] PR-26: add loongarch64 support
From: @openeuler-sync-bot 
Reviewed-by: @swf504 
Signed-off-by: @swf504
2024-08-08 07:02:45 +00:00
cenhuilin
d2d1693682 add loongarch64 support
(cherry picked from commit a8191474086ede7b5718047c93779fde5d9a2843)
2024-07-22 16:15:00 +08:00
openeuler-ci-bot
2597d63e44
!22 [sync] PR-19: riscv: add riscv64 support
From: @openeuler-sync-bot 
Reviewed-by: @liuzhiqiang26 
Signed-off-by: @liuzhiqiang26
2023-09-22 08:21:32 +00:00
Mingzheng Xing
daea6a8ad7 riscv: Add riscv64 support
Update to v0.6-25

Signed-off-by: Mingzheng Xing <xingmingzheng@iscas.ac.cn>
(cherry picked from commit 4119e9ac5c0f6ae8773cae78ac80352dc87375cd)
2023-09-22 15:47:02 +08:00
openeuler-ci-bot
41bfc17799
!17 [sync] PR-13: Specify the installation path as usr/sbin
From: @openeuler-sync-bot 
Reviewed-by: @liuzhiqiang26 
Signed-off-by: @liuzhiqiang26
2022-10-31 03:39:53 +00:00
wangzhiqiang
59d34d5cf9 specify the installation path as usr/sbin
(cherry picked from commit 54b3ee0c46a40bd5871ed9921697d754c937307a)
2022-10-31 10:48:24 +08:00
7 changed files with 299 additions and 2 deletions

View File

@ -0,0 +1,33 @@
From 79a1955551c06966370cc9fee4cec381de27eb54 Mon Sep 17 00:00:00 2001
From: Mingzheng Xing <xingmingzheng@iscas.ac.cn>
Date: Sun, 17 Sep 2023 21:59:48 +0800
Subject: [PATCH] riscv: Add riscv64 support
Signed-off-by: Mingzheng Xing <xingmingzheng@iscas.ac.cn>
---
iotop/ioprio.py | 2 ++
1 file changed, 2 insertions(+)
diff --git a/iotop/ioprio.py b/iotop/ioprio.py
index d292add..ba804c8 100644
--- a/iotop/ioprio.py
+++ b/iotop/ioprio.py
@@ -34,6 +34,7 @@ IOPRIO_GET_ARCH_SYSCALL = [
('ia64*', '*', 1275),
('parisc*', '*', 268),
('ppc*', '*', 274),
+ ('riscv64', '*', 31),
('s390*', '*', 283),
('sparc*', '*', 218),
('sh*', '*', 289),
@@ -49,6 +50,7 @@ IOPRIO_SET_ARCH_SYSCALL = [
('ia64*', '*', 1274),
('parisc*', '*', 267),
('ppc*', '*', 273),
+ ('riscv64', '*', 30),
('s390*', '*', 282),
('sparc*', '*', 196),
('sh*', '*', 288),
--
2.23.0

View File

@ -0,0 +1,33 @@
From 0ab9bc45ab09d98e9d6db082c9ea384093c65c39 Mon Sep 17 00:00:00 2001
From: cenhuilin <cenhuilin@kylinos.cn>
Date: Tue, 2 Jul 2024 16:52:03 +0800
Subject: [PATCH] loongarch64: add loongarch64 support
Signed-off-by: cenhuilin <cenhuilin@kylinos.cn>
---
iotop/ioprio.py | 2 ++
1 file changed, 2 insertions(+)
diff --git a/iotop/ioprio.py b/iotop/ioprio.py
index ba804c8..5ff5f61 100644
--- a/iotop/ioprio.py
+++ b/iotop/ioprio.py
@@ -27,6 +27,7 @@ import platform
# 'x86_64' but it will use the i386 syscall number, that's why we consider both
# the architecture name and the word size.
IOPRIO_GET_ARCH_SYSCALL = [
+ ('loongarch64', '*', 31),
('aarch64', '*', 31),
('alpha', '*', 443),
('arm*', '*', 315),
@@ -43,6 +44,7 @@ IOPRIO_GET_ARCH_SYSCALL = [
]
IOPRIO_SET_ARCH_SYSCALL = [
+ ('loongarch64', '*', 30),
('aarch64', '*', 30),
('alpha', '*', 442),
('arm*', '*', 314),
--
2.33.0

View File

@ -0,0 +1,89 @@
From 16a30ece6ab4eaa9ca5d056ada94673265195e27 Mon Sep 17 00:00:00 2001
From: Paul Wise <pabs3@bonedaddy.net>
Date: Thu, 4 Aug 2016 18:00:29 +0800
Subject: [PATCH] Hide UI elements on smaller terminals
This helps usability on smaller terminals.
Hide the status bar first, then the summary and then the titles,
since that is the approximate order of usefulness.
Conflict: Adapt patch Context
Reference: https://repo.or.cz/iotop.git/commit/16a30ece6ab4eaa9ca5d056ada94673265195e27
---
iotop/ui.py | 39 +++++++++++++++++++++++++++------------
1 file changed, 27 insertions(+), 12 deletions(-)
diff --git a/iotop/ui.py b/iotop/ui.py
index abd6b79..5a53ad6 100644
--- a/iotop/ui.py
+++ b/iotop/ui.py
@@ -410,8 +410,6 @@ class IOTopUI(object):
stats_lambda = lambda p: p.stats_delta
processes.sort(key=lambda p: key(p, stats_lambda(p)),
reverse=self.sorting_reverse)
- if not self.options.batch:
- del processes[self.height - 2:]
return list(map(format, processes))
def refresh_display(self, first_time, total, actual, duration):
@@ -448,10 +446,33 @@ class IOTopUI(object):
sys.stdout.flush()
else:
self.win.erase()
+
+ if Stats.has_blkio_delay_total:
+ status_msg = None
+ else:
+ status_msg = ('CONFIG_TASK_DELAY_ACCT not enabled in kernel, '
+ 'cannot determine SWAPIN and IO %')
+
+ len_summary = len(summary)
+ len_titles = int(bool(titles))
+ len_status_msg = int(bool(status_msg))
+ max_lines = self.height - len_summary - len_titles - len_status_msg
+ if max_lines < 5:
+ titles = []
+ len_titles = 0
+ if max_lines < 6:
+ summary = []
+ len_summary = 0
+ if max_lines < 7:
+ status_msg = None
+ len_status_msg = 0
+ max_lines = self.height - len_summary - len_titles - len_status_msg
+ num_lines = min(len(lines), max_lines)
+
for i, s in enumerate(summary):
self.win.addstr(i, 0, s[:self.width])
- self.win.hline(len(summary), 0, ord(' ') | curses.A_REVERSE,
- self.width)
+ if titles:
+ self.win.hline(len_summary, 0, ord(' ') | curses.A_REVERSE, self.width)
pos = 0
remaining_cols = self.width
for i in range(len(titles)):
@@ -464,18 +485,12 @@ class IOTopUI(object):
title += self.sorting_reverse and '>' or '<'
title = title[:remaining_cols]
remaining_cols -= len(title)
- self.win.addstr(len(summary), pos, title, attr)
+ self.win.addstr(len_summary, pos, title, attr)
pos += len(title)
- if Stats.has_blkio_delay_total:
- status_msg = None
- else:
- status_msg = ('CONFIG_TASK_DELAY_ACCT not enabled in kernel, '
- 'cannot determine SWAPIN and IO %')
- num_lines = min(len(lines), self.height - 2 - int(bool(status_msg)))
for i in range(num_lines):
try:
def print_line(line):
- self.win.addstr(i + len(summary) + 1, 0, line)
+ self.win.addstr(i + len_summary + len_titles, 0, line)
try:
print_line(lines[i])
except UnicodeEncodeError:
--
2.33.0

View File

@ -0,0 +1,49 @@
From 529a74a28be43c04840d937c87a5ee3b81133852 Mon Sep 17 00:00:00 2001
From: Paul Wise <pabs3@bonedaddy.net>
Date: Thu, 4 Aug 2016 18:24:46 +0800
Subject: [PATCH] Check the column title is not empty before using it
Fixes crash with terminals that don't fit all titles.
Traceback (most recent call last):
File "./iotop.py", line 12, in <module>
main()
File "./iotop/ui.py", line 669, in main
main_loop()
File "./iotop/ui.py", line 659, in <lambda>
main_loop = lambda: run_iotop(options)
File "./iotop/ui.py", line 554, in run_iotop
return curses.wrapper(run_iotop_window, options)
File "/usr/lib/python3.5/curses/__init__.py", line 94, in wrapper
return func(stdscr, *args, **kwds)
File "./iotop/ui.py", line 546, in run_iotop_window
ui.run()
File "./iotop/ui.py", line 176, in run
self.process_list.duration)
File "./iotop/ui.py", line 515, in refresh_display
self.win.addstr(len_summary, pos, title, attr)
_curses.error: addwstr() returned ERR
Conflict: NA
Reference: https://repo.or.cz/iotop.git/commit/529a74a28be43c04840d937c87a5ee3b81133852
---
iotop/ui.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/iotop/ui.py b/iotop/ui.py
index 30efa73..a957bdd 100644
--- a/iotop/ui.py
+++ b/iotop/ui.py
@@ -511,7 +511,8 @@ class IOTopUI(object):
title += self.sorting_reverse and '>' or '<'
title = title[:remaining_cols]
remaining_cols -= len(title)
- self.win.addstr(len_summary, pos, title, attr)
+ if title:
+ self.win.addstr(len_summary, pos, title, attr)
pos += len(title)
for i in range(num_lines):
try:
--
2.33.0

View File

@ -0,0 +1,40 @@
From 443737ec620a699286b9b2e44dbcaac53f553812 Mon Sep 17 00:00:00 2001
From: Yanichkin Alexander <Alexander_Sergey@mail.ru>
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 (<28>).
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

View File

@ -0,0 +1,32 @@
From 4b2e1aa2464cfc4a29c9565c9e143b52ef8e4848 Mon Sep 17 00:00:00 2001
From: Dominique Martinet <dominique.martinet@atmark-techno.com>
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

View File

@ -1,6 +1,6 @@
Name: iotop
Version: 0.6
Release: 23
Release: 28
Summary: Simple top-like I/O monitor
License: GPLv2+
URL: http://guichaz.free.fr/iotop/
@ -21,6 +21,12 @@ Patch8: 0008-Print-the-titles-at-specific-locations.patch
Patch9: 0009-Improve-the-message-that-is-printed-when-Linux-tasks.patch
Patch10: 0010-Fix-crash-due-to-syntax-error.patch
Patch11: 0011-Use-monotonic-time-to-calculate-durations.patch
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
@ -46,7 +52,7 @@ This contains man files for the using of iotop
%py3_build
%install
%py3_install
%{__python3} setup.py install -O1 --skip-build --root=%{buildroot} --install-scripts=%{_sbindir}
%files
%doc README
@ -58,6 +64,21 @@ This contains man files for the using of iotop
%{_mandir}/man8/iotop.*
%changelog
* Tue Dec 17 2024 lvyy <lyunmail@163.com> - 0.6-28
- Fix the iotop crash caused by non-UTF-8 characters
* Tue Nov 19 2024 lvyy <lyunmail@163.com> -0.6-27
- Fix crash when hide UI elements on smaller terminals
* Tue Jul 2 2024 cenhuilin <cenhuilin@kylinos.cn> - 0.6-26
- loongarch64: add loongarch64 support
* Sun Sep 17 2023 Mingzheng Xing <xingmingzheng@iscas.ac.cn> - 0.6-25
- riscv: Add riscv64 support
* Tue Jul 26 2022 wangzhiqiang <wangzhiqiang95@huawei.com> - 0.6-24
- DESC: specify the installation path as usr/sbin
* Fri Jul 30 2021 chenyanpanHW <chenyanpan@huawei.com> - 0.6-23
- DESC: delete -S git from %autosetup, and delete BuildRequires git