Replace patch procps-ng-3.3.16-comm_len.patch with upstream commitment patch procps-ng-3e1c00d0.patch

OBS-URL: https://build.opensuse.org/package/show/Base:System/procps?expand=0&rev=204
This commit is contained in:
Dr. Werner Fink 2020-09-24 15:32:29 +00:00 committed by Git OBS Bridge
parent e5fc82c641
commit 2c836b084c
4 changed files with 79 additions and 31 deletions

View File

@ -1,28 +0,0 @@
Bug bsc#1158830 -- "ps -C" does not allow anymore an argument longer than 15 characters
---
ps/select.c | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
--- ps/select.c
+++ ps/select.c 2019-12-11 13:07:05.428822333 +0000
@@ -116,10 +116,15 @@ static int proc_was_listed(proc_t *buf){
break; case SEL_TTY : return_if_match(tty,tty);
break; case SEL_SESS: return_if_match(session,pid);
- break; case SEL_COMM: i=sn->n; while(i--)
- if(!strncmp( buf->cmd, (*(sn->u+i)).cmd, 63 )) return 1;
-
-
+ break; case SEL_COMM: i=sn->n; while(i--){
+ /* In linux/sched.h TASK_COMM_LEN is still set to 15 characters plus \0 */
+ size_t coml = strlen(buf->cmd);
+ size_t cmdl = strlen((*(sn->u+i)).cmd);
+ if (coml < 15 && cmdl >= 15) return 0;
+ if (coml <= 15 && cmdl <= 15 && coml != cmdl) return 0;
+ if (cmdl > 15) cmdl = 15;
+ if(!strncmp( buf->cmd, (*(sn->u+i)).cmd, cmdl )) return 1;
+ }
#undef return_if_match

70
procps-ng-3e1c00d0.patch Normal file
View File

@ -0,0 +1,70 @@
From 3e1c00d051ae4a8319df7714d0545b4b7aa81557 Mon Sep 17 00:00:00 2001
From: Craig Small <csmall@dropbear.xyz>
Date: Thu, 24 Sep 2020 22:01:22 +1000
Subject: [PATCH] ps: Match on truncated 16 char for -C
The referenced commit the comm length was increased from 16 to 64
characters to handle the larger command names for things like kernel
threads.
However most user processes are limited to 15 characters which means
if you try something like ps -C myprogramisbiggerthansixteen this would
fail to match because /proc/<PID>/comm would only be myprogramisbigg
ps now checks the comm length and if it is 15 and if the given match
is 15 or more, it will only match the first 15 characters.
This is also how killall has worked for about a year.
Thanks to Jean Delvare <jdelvare@suse.de> for the note.
References:
commit 14005a371e5c14289e96a4927ffd1a827d3c9d85
commit psmisc/psmisc@1188315cd037d73bf946a0003b70c6423cc330d2
Signed-off-by: Craig Small <csmall@dropbear.xyz>
---
NEWS | 1 +
ps/select.c | 14 +++++++++-----
2 files changed, 10 insertions(+), 5 deletions(-)
|diff --git a/NEWS b/NEWS
|index 514f8ef..9dfd42f 100644
|--- a/NEWS
|+++ b/NEWS
|@@ -7,6 +7,7 @@ procps-ng NEXT
| * pgrep: Add older than selection merge #79
| * pidof: show worker threads Redhat #1803640
| * ps.1: Mention stime alias issue #164
|+ * ps: check also match on truncated 16 char comm names
| * sysctl: Match systemd directory order
| * sysctl: Document directory order Debian #951550
| * top: ensure config file backward compatibility Debian #951335
diff --git a/ps/select.c b/ps/select.c
index f58ca25..e26f2f1 100644
--- a/ps/select.c
+++ b/ps/select.c
@@ -116,11 +116,15 @@ static int proc_was_listed(proc_t *buf){
break; case SEL_TTY : return_if_match(tty,tty);
break; case SEL_SESS: return_if_match(session,pid);
- break; case SEL_COMM: i=sn->n; while(i--)
- if(!strncmp( buf->cmd, (*(sn->u+i)).cmd, 63 )) return 1;
-
-
-
+ break;
+ case SEL_COMM:
+ i=sn->n;
+ while(i--) {
+ /* special case, comm is 16 characters but match is longer */
+ if (strlen(buf->cmd) == 15 && strlen((*(sn->u+i)).cmd) >= 15)
+ if(!strncmp( buf->cmd, (*(sn->u+i)).cmd, 15 )) return 1;
+ if(!strncmp( buf->cmd, (*(sn->u+i)).cmd, 63 )) return 1;
+ }
#undef return_if_match
}
--
GitLab

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Thu Sep 24 15:24:11 UTC 2020 - Dr. Werner Fink <werner@suse.de>
- Replace patch procps-ng-3.3.16-comm_len.patch with upstream
commitment patch procps-ng-3e1c00d0.patch (bsc#1158830)
-------------------------------------------------------------------
Wed Aug 26 12:01:42 UTC 2020 - Thorsten Kukuk <kukuk@suse.com>

View File

@ -56,8 +56,8 @@ Patch31: procps-ng-3.3.8-ignore-scan_unevictable_pages.patch
Patch32: procps-ng-3.3.10-errno.patch
# PATCH-FEATURE-SUSE -- Let upstream pmap behave simialr to old suse pmap
Patch33: procps-ng-3.3.11-pmap4suse.patch
# PATCH-FEATURE-SUSE -- "ps -C" does not allow anymore an argument longer than 15 characters
Patch34: procps-ng-3.3.16-comm_len.patch
# PATCH-FIX-UPSTREAM -- "ps -C" does not allow anymore an argument longer than 15 characters
Patch34: procps-ng-3e1c00d0.patch
BuildRequires: automake
BuildRequires: dejagnu
@ -145,7 +145,7 @@ the process information pseudo-file system.
%patch31 -p1
%patch32
%patch33 -b .pmap4us
%patch34
%patch34 -p1
%build
#