Hi,

I was playing with ps today and noticed that the alignment of everything
following the "command" keyword seems to be broken currently.  An easy way
to test this is running ps -axo command,uid which gives me a wrongly aligned
uid for some processes:

/usr/X11R6/bin/X    35
X: [priv] (Xorg)        0
xenodm: :0 (xeno)        0

It look like this was broken in 1.83 which introduces print_comm_name() but
wrongly assumes the returned value is the length difference when it actually
is the updated length value. With this fixed I get a correctly aligned output:

/usr/X11R6/bin/X    35
X: [priv] (Xorg)     0
xenodm: :0 (xeno     0

ok?

diff --git bin/ps/print.c bin/ps/print.c
index 21709700847..65fa9ee9eb0 100644
--- bin/ps/print.c
+++ bin/ps/print.c
@@ -182,7 +182,7 @@ command(const struct pinfo *pi, VARENT *ve)
                                }
                                putchar('(');
                                left--;
-                               left -= print_comm_name(kp, left, 0);
+                               left = print_comm_name(kp, left, 0);
                                if (left == 0)
                                        return;
                                putchar(')');
@@ -193,7 +193,7 @@ command(const struct pinfo *pi, VARENT *ve)
                                putchar(' ');
                                left--;
                        }
-                       left -= print_comm_name(kp, left, 0);
+                       left = print_comm_name(kp, left, 0);
                }
        }
        if (ve->next != NULL)

Reply via email to