!46 update the release to 4.0.0-1

From: @hd-zhoujie 
Reviewed-by: @SuperSix173 
Signed-off-by: @SuperSix173
This commit is contained in:
openeuler-ci-bot 2022-11-04 09:22:46 +00:00 committed by Gitee
commit ac5c656b7c
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
10 changed files with 108 additions and 248 deletions

View File

@ -0,0 +1,68 @@
From 6e59f5e746c15df4d4b53f2df85b64aa1f10d0c3 Mon Sep 17 00:00:00 2001
From: xuchunmei <xuchunmei@huawei.com>
Date: Fri, 11 Jan 2019 01:29:55 -0500
Subject: [PATCH] procps-ng: add -M and -N options for top
Signed-off-by: xuchunmei <xuchunmei@huawei.com>
Signed-off-by: zhoujie <zhoujie133@huawei.com>
---
top/top.c | 15 ++++++++++++++-
top/top_nls.c | 2 ++
2 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/top/top.c b/top/top.c
index 04cf084..fbf0236 100644
--- a/top/top.c
+++ b/top/top.c
@@ -4076,7 +4076,7 @@ default_or_error:
* overridden -- we'll force some on and negate others in our
* best effort to honor the loser's (oops, user's) wishes... */
static void parse_args (int argc, char **argv) {
- static const char sopts[] = "bcd:E:e:Hhin:Oo:p:SsU:u:Vw::1";
+ static const char sopts[] = "bcd:E:e:Hhin:Oo:p:SsU:u:Vw::1MN:";
static const struct option lopts[] = {
{ "batch-mode", no_argument, NULL, 'b' },
{ "cmdline-toggle", no_argument, NULL, 'c' },
@@ -4097,6 +4097,8 @@ static void parse_args (int argc, char **argv) {
{ "version", no_argument, NULL, 'V' },
{ "width", optional_argument, NULL, 'w' },
{ "single-cpu-toggle", no_argument, NULL, '1' },
+ { "sort-by-mem", no_argument, NULL, 'M' },
+ { "display-task-num", required_argument, NULL, 'N' },
{ NULL, 0, NULL, 0 }
};
float tmp_delay = FLT_MAX;
@@ -4219,6 +4221,17 @@ static void parse_args (int argc, char **argv) {
error_exit(fmtmk(N_fmt(BAD_widtharg_fmt), cp));
Width_mode = (int)tmp;
continue;
+ case 'M':
+ {
+ Curwin->rc.sortindx = EU_MEM;
+ break;
+ }
+ case 'N':
+ {
+ if (sscanf(cp, "%d", &Curwin->rc.maxtasks) != 1 || Curwin->rc.maxtasks < 0)
+ error_exit(fmtmk("bad iterations arg '%s'", cp));
+ continue;
+ }
default:
// we'll rely on getopt for any error message ...
bye_bye(NULL);
diff --git a/top/top_nls.c b/top/top_nls.c
index 92f12ba..2e9c7fd 100644
--- a/top/top_nls.c
+++ b/top/top_nls.c
@@ -409,6 +409,8 @@ static void build_norm_nlstab (void) {
" -u, --filter-only-euser =USER show only processes owned by USER\n"
" -w, --width [=COLUMNS] change print width [,use COLUMNS]\n"
" -1, --single-cpu-toggle reverse last remembered '1' state\n"
+ " -M, --sort-by-mem show tasks by memory usage\n"
+ " -N, --show-task-num show the specified number of tasks\n"
"\n"
" -h, --help display this help text, then exit\n"
" -V, --version output version information & exit\n"
--
2.33.0

View File

@ -1,79 +0,0 @@
From 84e85611c36d31a478e1b62e5668671d9389265d Mon Sep 17 00:00:00 2001
From: Jim Warner <james.warner@comcast.net>
Date: Mon, 31 May 2021 00:00:00 -0500
Subject: [PATCH] top: fix two potential 'alternate display mode' abends
This commit will address potential abends upon leaving
the windows help or color mapping screens and invoking
alternate display mode ('A'). It only happens if that
current window was changed with multiple 'a'/'w' keys.
So now, rather than leaving a trail of negative values
in the 'begtask' field, compliments of that win_select
function, we'll remove the mkVIZrow1 macro. Henceforth
it will be issued just once per user interaction. Thus
a promise of 'Curwin' only being impacted is restored.
[ my thanks to Vladimir Chren for reporting this bug ]
Reference(s):
https://gitlab.com/procps-ng/procps/-/issues/210
https://gitlab.com/procps-ng/procps/-/merge_requests/135
Discovered by:Vladimir Chren <vladimir.chren@gmail.com>
Signed-off-by: Jim Warner <james.warner@comcast.net>
---
top/top.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/top/top.c b/top/top.c
index c1f30fb..dd6e3d5 100644
--- a/top/top.c
+++ b/top/top.c
@@ -4475,7 +4475,6 @@ static WIN_t *win_select (int ch) {
break;
}
Curwin = w;
- mkVIZrow1(Curwin);
return Curwin;
} // end: win_select
@@ -5148,6 +5147,7 @@ static void keys_global (int ch) {
case '?':
case 'h':
help_view();
+ mkVIZrow1(Curwin);
break;
case 'B':
TOGw(w, View_NOBOLD);
@@ -5175,6 +5175,7 @@ static void keys_global (int ch) {
break;
case 'g':
win_select(0);
+ mkVIZrow1(Curwin);
break;
case 'H':
Thread_mode = !Thread_mode;
@@ -5254,6 +5255,7 @@ static void keys_global (int ch) {
break;
case 'Z':
wins_colors();
+ mkVIZrow1(Curwin);
break;
case '0':
Rc.zero_suppress = !Rc.zero_suppress;
@@ -5573,7 +5575,10 @@ static void keys_window (int ch) {
break;
case 'a':
case 'w':
- if (ALTCHKw) win_select(ch);
+ if (ALTCHKw) {
+ win_select(ch);
+ mkVIZrow1(Curwin);
+ }
break;
case 'G':
if (ALTCHKw) {
--
1.8.3.1

View File

@ -1,35 +0,0 @@
From 0bf15c004db6a3342703a3c420a5692e376c457d Mon Sep 17 00:00:00 2001
From: Shaohua Zhan <shaohua.zhan@windriver.com>
Date: Thu, 3 Dec 2020 10:24:09 +0800
Subject: [PATCH] top: In the bye_bye function, replace fputs with the write
interface.
When top calls malloc, if a signal is received, it will
call sig_endpgm to process the signal. In the bye_bye function, if the
-b option is enable, the Batch variable is set, the fputs function
will calls malloc at the same time. The malloc function is not reentrant, so
it will cause the program to crash.
Signed-off-by: Shaohua Zhan <shaohua.zhan@windriver.com>
---
top/top.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/top/top.c b/top/top.c
index 2ec6357..eb62001 100644
--- a/top/top.c
+++ b/top/top.c
@@ -571,7 +571,9 @@ static void bye_bye (const char *str) {
fputs(str, stderr);
exit(EXIT_FAILURE);
}
- if (Batch) fputs("\n", stdout);
+ if (Batch) {
+ write(fileno(stdout), "\n", sizeof("\n"));
+ }
exit(EXIT_SUCCESS);
} // end: bye_bye
--
1.8.3.1

View File

@ -0,0 +1,27 @@
From 68bd42fb10cfaf278e841d2925da7f061820abd4 Mon Sep 17 00:00:00 2001
From: xuchunmei <xuchunmei@huawei.com>
Date: Wed, 23 Jan 2019 07:57:53 -0500
Subject: [PATCH] top: exit with error when pid overflow
Signed-off-by: xuchunmei <xuchunmei@huawei.com>
---
top/top.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/top/top.c b/top/top.c
index fbf0236..4bcfff0 100644
--- a/top/top.c
+++ b/top/top.c
@@ -4189,7 +4189,8 @@ static void parse_args (int argc, char **argv) {
if (Monpidsidx >= MONPIDMAX)
error_exit(fmtmk(N_fmt(LIMIT_exceed_fmt), MONPIDMAX));
if (1 != sscanf(cp, "%d", &pid)
- || strpbrk(cp, "+-."))
+ || strpbrk(cp, "+-.")
+ || 0 > pid)
error_exit(fmtmk(N_fmt(BAD_mon_pids_fmt), cp));
if (!pid) pid = getpid();
for (i = 0; i < Monpidsidx; i++)
--
2.33.0

View File

@ -1,55 +0,0 @@
From 6e59f5e746c15df4d4b53f2df85b64aa1f10d0c3 Mon Sep 17 00:00:00 2001
From: xuchunmei <xuchunmei@huawei.com>
Date: Fri, 11 Jan 2019 01:29:55 -0500
Subject: [PATCH] procps-ng: add -M and -N options for top
Signed-off-by: xuchunmei <xuchunmei@huawei.com>
---
top/top.c | 17 +++++++++++++++++
top/top_nls.c | 2 +-
2 files changed, 18 insertions(+), 1 deletion(-)
diff --git a/top/top.c b/top/top.c
index b53e532..20cf7a1 100644
--- a/top/top.c
+++ b/top/top.c
@@ -4337,6 +4337,23 @@ static void parse_args (char **args) {
args += ai;
if (pn) cp = pn + ci;
} continue;
+ case 'M':
+ {
+ Curwin->rc.sortindx = EU_MEM;
+ break;
+ }
+ case 'N':
+ {
+ if (cp[1])
+ cp++;
+ else if (*args)
+ cp = *args++;
+ else
+ error_exit("-N requires argument");
+ if (sscanf(cp, "%d", &Curwin->rc.maxtasks) != 1 || Curwin->rc.maxtasks < 0)
+ error_exit(fmtmk("bad iterations arg '%s'", cp));
+ break;
+ }
default :
error_exit(fmtmk(N_fmt(UNKNOWN_opts_fmt)
, *cp, Myname, N_txt(USAGE_abbrev_txt)));
diff --git a/top/top_nls.c b/top/top_nls.c
index ab3029e..97c3468 100644
--- a/top/top_nls.c
+++ b/top/top_nls.c
@@ -350,7 +350,7 @@ static void build_norm_nlstab (void) {
Norm_nlstab[OFF_one_word_txt] = _("Off");
/* Translation Hint: Only the following words should be translated
. secs (seconds), max (maximum), user, field, cols (columns)*/
- Norm_nlstab[USAGE_abbrev_txt] = _(" -hv | -bcEeHiOSs1 -d secs -n max -u|U user -p pid(s) -o field -w [cols]");
+ Norm_nlstab[USAGE_abbrev_txt] = _(" -hv | -bcEeHiOSs1 -d secs -n max -u|U user -p pid(s) -o field -w [cols] -M -N num");
Norm_nlstab[FAIL_statget_txt] = _("failed /proc/stat read");
Norm_nlstab[FOREST_modes_fmt] = _("Forest mode %s");
Norm_nlstab[FAIL_tty_get_txt] = _("failed tty get");
--
2.27.0

View File

@ -1,27 +0,0 @@
From 68bd42fb10cfaf278e841d2925da7f061820abd4 Mon Sep 17 00:00:00 2001
From: xuchunmei <xuchunmei@huawei.com>
Date: Wed, 23 Jan 2019 07:57:53 -0500
Subject: [PATCH] top: exit with error when pid overflow
Signed-off-by: xuchunmei <xuchunmei@huawei.com>
---
top/top.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/top/top.c b/top/top.c
index 9bfc7f0..d1dbf95 100644
--- a/top/top.c
+++ b/top/top.c
@@ -4098,7 +4098,8 @@ static void parse_args (char **args) {
if (Monpidsidx >= MONPIDMAX)
error_exit(fmtmk(N_fmt(LIMIT_exceed_fmt), MONPIDMAX));
if (1 != sscanf(cp, "%d", &pid)
- || strpbrk(cp, "+-."))
+ || strpbrk(cp, "+-.")
+ || 0 > pid)
error_exit(fmtmk(N_fmt(BAD_mon_pids_fmt), cp));
if (!pid) pid = getpid();
for (i = 0; i < Monpidsidx; i++)
--
1.8.3.1

View File

@ -1,39 +0,0 @@
From 27e60e86e9f5b85520da001422176700fc9d824a Mon Sep 17 00:00:00 2001
From: Jim Warner <james.warner@comcast.net>
Date: Mon, 21 Jun 2021 00:00:00 -0500
Subject: [PATCH] top: fix a fix for the 'bye_bye' function (merge #127)
In the merge request shown below, 1 too many bytes are
written to stdout thus including the terminating null.
As the cure, this commit just reduces the length by 1.
[ along the way, we will remove some unneeded braces ]
[ plus add some additional comments with attribution ]
Reference(s):
https://gitlab.com/procps-ng/procps/-/merge_requests/127
. original ported cchange
commit 6b8980a3b6279058d727377e914cfb6439d6f178
Signed-off-by: Jim Warner <james.warner@comcast.net>
---
top/top.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/top/top.c b/top/top.c
index b3e1bcf..9248c7a 100644
--- a/top/top.c
+++ b/top/top.c
@@ -572,7 +572,7 @@ static void bye_bye (const char *str) {
exit(EXIT_FAILURE);
}
if (Batch) {
- write(fileno(stdout), "\n", sizeof("\n"));
+ write(fileno(stdout), "\n", sizeof("\n") - 1);
}
exit(EXIT_SUCCESS);
} // end: bye_bye
--
1.8.3.1

Binary file not shown.

BIN
procps-ng-4.0.0.tar.xz Normal file

Binary file not shown.

View File

@ -1,6 +1,6 @@
Name: procps-ng
Version: 3.3.17
Release: 2
Version: 4.0.0
Release: 1
Summary: Utilities that provide system information.
License: GPL+ and GPLv2 and GPLv2+ and GPLv3+ and LGPLv2+
URL: https://sourceforge.net/projects/procps-ng/
@ -9,11 +9,8 @@ Source0: http://downloads.sourceforge.net/%{name}/%{name}-%{version}.tar.xz
Source1: README.md
Source2: README.top
Patch1: 0001-top-fix-two-potential-alternate-display-mode-abends.patch
Patch2: 0002-top-In-the-bye_bye-function-replace-fputs-with-the-w.patch
Patch3: 0003-add-options-M-and-N-for-top.patch
Patch4: 0004-top-exit-with-error-when-pid-overflow.patch
Patch5: 0005-fix-a-fix-for-the-bye_bye-function.patch
Patch1: 0001-add-M-and-N-options-for-top.patch
Patch2: 0002-top-exit-with-error-when-pid-overflow.patch
BuildRequires: ncurses-devel libtool autoconf automake gcc gettext-devel systemd-devel
@ -45,7 +42,7 @@ The package is used for the Internationalization of %{name}
%package_help
%prep
%autosetup -n procps-%{version} -p1
%autosetup -n procps-ng-%{version} -p1
cp -p %{SOURCE1} .
cp -p %{SOURCE2} top/
@ -71,10 +68,10 @@ ln -s %{_bindir}/pidof %{buildroot}%{_sbindir}/pidof
%doc COPYING COPYING.LIB
%{!?_licensedir:%global license %%doc}
%license COPYING COPYING.LIB
%{_libdir}/libprocps.so.*
%{_libdir}/libproc-2.so.*
%{_bindir}/*
%{_sbindir}/*
%exclude %{_libdir}/libprocps.la
%exclude %{_libdir}/libproc-2.la
%exclude /unwanted/*
%exclude %{_libdir}/*.a
@ -82,9 +79,9 @@ ln -s %{_bindir}/pidof %{buildroot}%{_sbindir}/pidof
%doc COPYING COPYING.LIB
%{!?_licensedir:%global license %%doc}
%license COPYING COPYING.LIB
%{_libdir}/libprocps.so
%{_libdir}/pkgconfig/libprocps.pc
%{_includedir}/proc
%{_libdir}/libproc-2.so
%{_libdir}/pkgconfig/libproc-2.pc
%{_includedir}/procps
%files i18n -f %{name}.lang
@ -93,6 +90,9 @@ ln -s %{_bindir}/pidof %{buildroot}%{_sbindir}/pidof
%{_mandir}/man*
%changelog
* Fri Nov 4 2022 zhoujie <zhoujie133@h-partners.com> - 4.0.0-1
- update the release to 4.0.0-1
* Sat Jan 29 2022 zhouwenpei <zhouwenpei1@h-partners.com> - 3.3.17-2
- fix file type chamges caused by top -b redirection