Subject: [patch][rfc] bug in /bin/ps -o start= output
To: None <current-users@netbsd.org>
From: =?iso-8859-2?Q?Martin_Ma=E8ok?= <martin.macok@underground.cz>
List: current-users
Date: 01/20/2002 21:07:06
Hi,
since my english sucks, I will speak in a shell:

[otaku:~]% uname -srm=20
NetBSD 1.5ZA i386

% ps -ao uid=3D,start=3D,user=3D
    =20
205 - orbman =20
205 - orbman =20
200 - salo   =20
200  salo   =20
207 - toma   =20
207  toma   =20
201 - priikone

This is odd.

% ps -ao uid=3Dab,start=3Dcd,user=3Dxy
 ab cd xy
205  - orbman =20
205  - orbman =20
200  - salo   =20
200 9: salo   =20
207  - toma   =20
207 Th toma   =20

This is even more odd IMHO.


$ uname -srm
OpenBSD 3.0 i386

$ ps -ao uid=3D,start=3D,user=3D
              =20
  202  9:52PM  orbman =20
  202  9:53PM  orbman =20
    0  5:27PM  root   =20
    0  5:27PM  root   =20
    0  5:27PM  root   =20

$ ps -ao uid=3Dab,start=3Dcd,user=3Dxy
   ab cd       xy
  202  9:52PM  orbman =20
  202  9:53PM  orbman =20
    0  5:27PM  root   =20
    0  5:27PM  root   =20
    0  5:27PM  root   =20

Both OpenBSD's /bin/ps output seems good for me.

So I took a quick look into openbsd's /bin/ps sources and changed it:

--- print.c~	Sun Jan 20 20:20:44 2002
+++ print.c	Sun Jan 20 20:15:58 2002
@@ -601,7 +601,7 @@ started(k, ve, mode)
 	 *      "STARTED" for locales that have 3 letter abbreviated month
 	 *      names and 2 letter am/pm descriptions.
 	 */
-	if (mode =3D=3D WIDTHMODE)
+	if (mode =3D=3D WIDTHMODE && v->width > 7)
 		return;
=20
 	v =3D ve->var;


Now with that patched /bin/ps on NetBSD

% ./ps -ao uid=3D,start=3D,user=3D=20
           =20
205  9:00PM orbman =20
200       - salo   =20
200  9:49AM salo   =20
207       - toma   =20
207 Thu08PM toma   =20
201       - priikone

% ./ps -ao uid=3Dab,start=3Dcd,user=3Dxy
 ab      cd xy
205  9:00PM orbman =20
200       - salo   =20
200  9:49AM salo   =20
207       - toma   =20
207 Thu08PM toma   =20
201       - priikone

% ./ps -ao uid=3Daaaaaaaaaaaaaa,start=3Dbbbbbbbbbbbbbbbb,user=3Dccc
aaaaaaaaaaaaaa bbbbbbbbbbbbbbbb ccc
           205           9:02PM orbman =20
           205                - orbman =20
           200                - salo   =20
           200           9:49AM salo   =20
           207                - toma   =20
           207          Thu08PM toma   =20
           201                - priikone
           201          Thu09PM priikone
           205           6:00PM orbman =20

Any comments? Please Cc: me on replies, I'm off the list.

Thanks and have a nice day

--=20
         Martin Ma=E8ok                 http://underground.cz/
   martin.macok@underground.cz        http://Xtrmntr.org/ORBman/