Hi,

I added the following two patches to procps:2:4.0.2-3 in bookworm.

This resolved this issue.

Since this bug is also available in bookworm, can you please provide a update for stable?

Thanks
Manuel
From 35dc38cb7fcfb71b151a020abb16197b88370337 Mon Sep 17 00:00:00 2001
From: Jim Warner <james.war...@comcast.net>
Date: Wed, 24 May 2023 00:00:00 -0500
Subject: [PATCH 1/2] ps: address missing or corrupted fields with -m option

Coincidentally, a Debian bug report and a gitlab issue
were raised at nearly the same time and are referenced
below. They both dealt with that '-m' (thread) option.

That option forces tasks and their threads to be shown
on separate lines. Also, information may be suppressed
between that main process and any lightweight process.

The bottom line was sometimes a required pids_item may
not have been requested from the library before trying
to display a result. For the best case, some incorrect
results might be shown. However, in the worst case (as
with PIDS_WCHAN_NAME) a segmentation fault is created.

[ After addressing the '-m' option problems, another ]
[ issue was found with that '-F' (extra full format) ]
[ option. The PSR (processor) field was always zero. ]
[ It was addressed in a similar manner to the above. ]

Reference(s):
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1036631
https://gitlab.com/procps-ng/procps/-/issues/279

Signed-off-by: Jim Warner <james.war...@comcast.net>
---
 src/ps/display.c | 7 +++++++
 1 file changed, 7 insertions(+)

Index: procps-4.0.2/src/ps/display.c
===================================================================
--- procps-4.0.2.orig/src/ps/display.c
+++ procps-4.0.2/src/ps/display.c
@@ -596,6 +596,13 @@ static void finalize_stacks (void)
   // special items with 'extra' used as former pcpu
   chkREL(extra)
   chkREL(noop)
+  // lastly, any remaining needs ...
+  if (format_flags & FF_Uf)
+    chkREL(PROCESSOR);
+  if (thread_flags & TF_U_m) {
+    chkREL(PRIORITY);
+    chkREL(WCHAN_NAME);
+  }
 
   // now accommodate any results not yet satisfied
   f_node = format_list;
From 93b7f05e54293af4919498fceedb236a523336df Mon Sep 17 00:00:00 2001
From: Jim Warner <james.war...@comcast.net>
Date: Fri, 26 May 2023 00:00:00 -0500
Subject: [PATCH 2/2] ps: trade previous fix for final solution to -m option

Well as luck would have it I found yet another missing
field (SCHED_CLASS) that's needed by that '-m' option.
And, while it could just be added to the previous test
of thread_flags and TF_U_m, here is a much better fix.

[ The problem lies with the lists_and_needs function ]
[ where a new format list was created and some print ]
[ functions changed to pr_nop which displays a dash! ]

[ So, by calling the finalize_stacks function before ]
[ calling lists_and_needs, the former will see those ]
[ format nodes before any print function is changed. ]

Reference(s):
May, 2023 - missing fields with -m option
commit 35dc38cb7fcfb71b151a020abb16197b88370337

Signed-off-by: Jim Warner <james.war...@comcast.net>
---
 src/ps/display.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

Index: procps-4.0.2/src/ps/display.c
===================================================================
--- procps-4.0.2.orig/src/ps/display.c
+++ procps-4.0.2/src/ps/display.c
@@ -596,13 +596,6 @@ static void finalize_stacks (void)
   // special items with 'extra' used as former pcpu
   chkREL(extra)
   chkREL(noop)
-  // lastly, any remaining needs ...
-  if (format_flags & FF_Uf)
-    chkREL(PROCESSOR);
-  if (thread_flags & TF_U_m) {
-    chkREL(PRIORITY);
-    chkREL(WCHAN_NAME);
-  }
 
   // now accommodate any results not yet satisfied
   f_node = format_list;
@@ -672,8 +665,8 @@ int main(int argc, char *argv[]){
 
   init_output(); /* must be between parser and output */
 
-  lists_and_needs();
   finalize_stacks();
+  lists_and_needs();
 
   if(forest_type || sort_list) fancy_spew(); /* sort or forest */
   else simple_spew(); /* no sort, no forest */

Reply via email to