File procps-ng-3.3.16-comm_len.patch of Package procps.13641

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
 
openSUSE Build Service is sponsored by