!113 [sync] PR-112: backport patch to correct BSD c option issue
From: @openeuler-sync-bot Reviewed-by: @SuperSix173 Signed-off-by: @SuperSix173
This commit is contained in:
commit
4f70843a53
73
backport-ps-Correct-BSD-c-option.patch
Normal file
73
backport-ps-Correct-BSD-c-option.patch
Normal file
@ -0,0 +1,73 @@
|
||||
From dd3cb0892d142e370413e1cba582d390042883e5 Mon Sep 17 00:00:00 2001
|
||||
From: Craig Small <csmall@dropbear.xyz>
|
||||
Date: Mon, 19 Dec 2022 16:50:12 +1100
|
||||
Subject: [PATCH] ps: Correct BSD c option
|
||||
|
||||
procps 3.3.17 the c option changed the command/args field
|
||||
to cmd but this got removed as part of newlib
|
||||
|
||||
Functionality is back in with a test case.
|
||||
|
||||
References:
|
||||
https://bugs.debian.org/1026326
|
||||
|
||||
Signed-off-by: Craig Small <csmall@dropbear.xyz>
|
||||
---
|
||||
NEWS | 1 +
|
||||
src/ps/output.c | 7 +++++--
|
||||
testsuite/ps.test/ps_output.exp | 6 ++++++
|
||||
3 files changed, 12 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/NEWS b/NEWS
|
||||
index 2d13978d..8a2d6b04 100644
|
||||
--- a/NEWS
|
||||
+++ b/NEWS
|
||||
@@ -2,7 +2,8 @@ procps-ng-NEXT
|
||||
---------------
|
||||
* docs: Don't install English manpages twice
|
||||
* skill: Match on -p again Debian #1025915
|
||||
+ * ps: c flag shows command name again Debian #1026326
|
||||
* vmstat: Referesh memory statistics Debian #1027963
|
||||
procps-ng-4.0.2
|
||||
---------------
|
||||
* library revision - 0:1:0
|
||||
diff --git a/src/ps/output.c b/src/ps/output.c
|
||||
index 5a14f5be..26001a6c 100644
|
||||
--- a/src/ps/output.c
|
||||
+++ b/src/ps/output.c
|
||||
@@ -403,13 +403,16 @@ Modifications to the arguments are not shown.
|
||||
static int pr_args(char *restrict const outbuf, const proc_t *restrict const pp){
|
||||
char *endp;
|
||||
int rightward, fh;
|
||||
-setREL2(CMDLINE,ENVIRON)
|
||||
+setREL3(CMDLINE,CMD,ENVIRON)
|
||||
endp = outbuf;
|
||||
rightward = max_rightward;
|
||||
fh = forest_helper(outbuf);
|
||||
endp += fh;
|
||||
rightward -= fh;
|
||||
- endp += escape_str(endp, rSv(CMDLINE, str, pp), OUTBUF_SIZE_AT(endp), &rightward);
|
||||
+ if (!bsd_c_option)
|
||||
+ endp += escape_str(endp, rSv(CMDLINE, str, pp), OUTBUF_SIZE_AT(endp), &rightward);
|
||||
+ else
|
||||
+ endp += escape_str(endp, rSv(CMD, str, pp), OUTBUF_SIZE_AT(endp), &rightward);
|
||||
if(bsd_e_option && rightward>1) {
|
||||
char *e = rSv(ENVIRON, str, pp);
|
||||
if(*e != '-' || *(e+1) != '\0') {
|
||||
diff --git a/testsuite/ps.test/ps_output.exp b/testsuite/ps.test/ps_output.exp
|
||||
index 998490e5..b0f789e0 100644
|
||||
--- a/testsuite/ps.test/ps_output.exp
|
||||
+++ b/testsuite/ps.test/ps_output.exp
|
||||
@@ -51,3 +51,9 @@ expect_pass "$test" "error: missing AIX field descriptor"
|
||||
set test "ps with unknown AIX field"
|
||||
spawn $ps -o "%p %Z"
|
||||
expect_pass "$test" "error: unknown AIX field descriptor"
|
||||
+
|
||||
+make_testproc
|
||||
+set test "ps with c option"
|
||||
+spawn $ps co command $testproc1_pid
|
||||
+expect_pass "$test" "^COMMAND\\s+spcorp\\s*$"
|
||||
+kill_testproc
|
||||
--
|
||||
2.33.0
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
Name: procps-ng
|
||||
Version: 4.0.2
|
||||
Release: 10
|
||||
Release: 11
|
||||
Summary: Utilities that provide system information.
|
||||
License: GPL+ and GPLv2 and GPLv2+ and GPLv3+ and LGPLv2+
|
||||
URL: https://sourceforge.net/projects/procps-ng/
|
||||
@ -22,6 +22,7 @@ Patch10: backport-library-restore-the-proper-main-thread-tics-valuation.patch
|
||||
Patch11: backport-vmstat-Update-memory-statistics.patch
|
||||
Patch12: backport-vmstat-Print-guest-time.patch
|
||||
Patch13: backport-ps-Fix-possible-buffer-overflow-in-C-option.patch
|
||||
Patch14: backport-ps-Correct-BSD-c-option.patch
|
||||
|
||||
BuildRequires: ncurses-devel libtool autoconf automake gcc gettext-devel systemd-devel systemd-pam
|
||||
|
||||
@ -104,6 +105,9 @@ ln -s %{_bindir}/pidof %{buildroot}%{_sbindir}/pidof
|
||||
%{_mandir}/man*
|
||||
|
||||
%changelog
|
||||
* Fri Mar 29 2024 Weifeng Su <suweifeng1@huawei.com> - 4.0.2-11
|
||||
- backport patch to Correct BSD c option issue
|
||||
|
||||
* Tue Aug 15 2023 Liu Chao <liuchao173@huawei.com> - 4.0.2-10
|
||||
- ps: Fix possible buffer overflow in -C option
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user