Re: ps(1): fix command alignment
On Tue, 7 Mar 2023, Tobias Heider wrote: > 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/X35 > 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/X35 > X: [priv] (Xorg) 0 > xenodm: :0 (xeno 0 > > ok? Oops, yeah. ok guenther@
Re: ps(1): fix command alignment
On Wed, 08 Mar 2023 01:37:18 +0100, Tobias Heider wrote: > 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 OK millert@ - todd
Re: ps(1): fix command alignment
On Wed, Mar 08, 2023 at 01:37:18AM +0100, Tobias Heider wrote: > 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/X35 > X: [priv] (Xorg)0 > xenodm: :0 (xeno)0 > > It look like this was broken in 1.83 which introduces print_comm_name() but Oops, print.c - rev 1.85 is what i meant
ps(1): fix command alignment
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/X35 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/X35 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)