Package: procps
Version: 2:4.0.2-1

Since 2022-12-05 the Debian sid builds of linuxcnc have failed.  After
some days scratching our heads, we discovered that the problem
originated from 'ps' changout its output format.  Running 'ps -o comm=
<pid>' used to include '<defunct>' if the process was a zombie, but with
the new version it no longer did.

Eventually a solution was found and the following patch from
<URL: 
https://github.com/LinuxCNC/linuxcnc/commit/7e974894ad3b1fd75139a318c133a9ec10635e87
 >
worked around the changed output:

diff --git a/scripts/linuxcnc.in b/scripts/linuxcnc.in
index 166bf499c0..0fa78303ad 100644
--- a/scripts/linuxcnc.in
+++ b/scripts/linuxcnc.in
@@ -592,7 +592,7 @@ function KillTaskWithTimeout() {
     fi
     local NPROCS
     for KILL_PID in $KILL_PIDS ; do
-        if $PS -o comm= $KILL_PID | $GREP -q '<defunct>'; then
+        if $PS -o stat= -o comm= $KILL_PID | $GREP -q '^Z'; then
             echo "Skipping defunct task $KILL_TASK, PID=$KILL_PID" 
>>$PRINT_FILE
             continue
         fi
@@ -602,7 +602,7 @@ function KillTaskWithTimeout() {
        # wait and see if it disappears
        while [ $WAIT -gt 1 ] ; do
            # see if it's still alive
-            NPROCS=$($PS -o comm= $KILL_PID | $GREP -v '<defunct>' | wc -l)
+            NPROCS=$($PS -o stat= -o comm= $KILL_PID | $GREP -v '^Z' | wc -l)
             if [ $NPROCS -gt 0 ]; then
                WAIT=$(($WAIT-1))
                sleep .1
@@ -618,7 +618,7 @@ function KillTaskWithTimeout() {
            # wait and see if it disappears
            while [ $WAIT -gt 1 ] ; do
                # see if it's still alive
-                NPROCS=$($PS -o comm= $KILL_PID | $GREP -v '<defunct>' | wc -l)
+                NPROCS=$($PS -o stat= -o comm= $KILL_PID | $GREP -v '^Z' | wc 
-l)
                 if [ $NPROCS -gt 0 ]; then
                    WAIT=$(($WAIT-1))
                    sleep .1

I do not know if this new behaviour is intended or not, but thought it
best to let you know about the issue it caused.

-- 
Happy hacking
Petter Reinholdtsen

Reply via email to