top: fix sort-by-memory when beg_task is reset

Resolves: RHEL-176043
This commit is contained in:
Jan Rybar 2026-05-13 17:26:52 +02:00
parent 9c0d89f78a
commit cce2e147c4
2 changed files with 34 additions and 1 deletions

View File

@ -4,7 +4,7 @@
Summary: System and process monitoring utilities
Name: procps-ng
Version: 4.0.4
Release: 12%{?dist}
Release: 13%{?dist}
License: GPL-2.0-or-later AND LGPL-2.0-or-later AND LGPL-2.1-or-later
URL: https://sourceforge.net/projects/procps-ng/
@ -17,6 +17,7 @@ Patch4: sysctl-succ-on-fail.patch
Patch5: ps-etime-overflow.patch
Patch6: uptime-w-user-sessions-only.patch
Patch7: uptime-bad-rounding.patch
Patch8: top-sort-by-mem-begtask-reset.patch
BuildRequires: make
BuildRequires: ncurses-devel
@ -153,6 +154,10 @@ ln -s %{_bindir}/pidof %{buildroot}%{_sbindir}/pidof
%files i18n -f %{name}.lang
%changelog
* Tue May 12 2026 Jan Rybar <jrybar@redhat.com> - 4.0.4-13
- top: fix sort-by-memory when beg_task is reset
- Resolves: RHEL-176043
* Thu Apr 30 2026 Jan Rybar <jrybar@redhat.com> - 4.0.4-12
- uptime: bad time rounding when using -p
- Resolves: RHEL-60825

View File

@ -0,0 +1,28 @@
diff --git a/src/top/top.c b/src/top/top.c
index 8bf5727..a2bc500 100644
--- a/src/top/top.c
+++ b/src/top/top.c
@@ -5892,6 +5892,7 @@ static void keys_task (int ch) {
#endif
if (p >= w->procflgs) {
w->rc.sortindx = *p;
+ w->begtask = 0;
#ifndef TREE_NORESET
OFFw(w, Show_FOREST);
#endif
@@ -5913,6 +5914,7 @@ static void keys_task (int ch) {
#endif
if (p < w->procflgs + w->maxpflgs) {
w->rc.sortindx = *p;
+ w->begtask = 0;
#ifndef TREE_NORESET
OFFw(w, Show_FOREST);
#endif
@@ -6235,6 +6237,7 @@ static void keys_xtra (int ch) {
default: // keep gcc happy
break;
}
+ w->begtask = 0;
// some have objected to this message, so we'll just keep silent...
// show_msg(fmtmk("%s sort compatibility key honored", xmsg));
} // end: keys_xtra