Subject: Re: [patch][rfc] bug in /bin/ps -o start= output
To: =?ISO-8859-2?Q?Martin_Ma=E8ok?= <martin.macok@underground.cz>
From: Jaromir Dolecek <jdolecek@netbsd.org>
List: current-users
Date: 01/22/2002 00:12:29
Fixed, thanks for report. I'll request pullup of the fix to
1.5 branch soon.
The change committed was a bit different, to avoid hardcoding any
particular value in there. For example, with working LC_TIME locales,
the field is commonly only 5 characters in czech (no AM/PM).
Can you confirm this fix works for you as good as the original
fix?
Index: print.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvsroot/basesrc/bin/ps/print.c,v
retrieving revision 1.69
retrieving revision 1.70
diff -u -p -r1.69 -r1.70
--- print.c 2001/08/24 06:37:03 1.69
+++ print.c 2002/01/21 23:01:55 1.70
@@ -595,14 +595,6 @@ started(k, ve, mode)
time_t startt;
struct tm *tp;
char buf[100], *cp;
-
- /*
- * XXX: The maximum width of this field is the same as the header
- * "STARTED" for locales that have 3 letter abbreviated month
- * names and 2 letter am/pm descriptions.
- */
- if (mode =3D=3D WIDTHMODE)
- return;
=20
v =3D ve->var;
if (!k->p_uvalid) {
Jaromir
Martin Ma=E8ok wrote:
> Hi,
> since my english sucks, I will speak in a shell:
>=20
> [otaku:~]% uname -srm=20
> NetBSD 1.5ZA i386
>=20
> % 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
>=20
> This is odd.
>=20
> % 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
>=20
> This is even more odd IMHO.
>=20
>=20
> $ uname -srm
> OpenBSD 3.0 i386
>=20
> $ 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
>=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
>=20
> Both OpenBSD's /bin/ps output seems good for me.
>=20
> So I took a quick look into openbsd's /bin/ps sources and changed it:
>=20
> --- 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;
>=20
>=20
> Now with that patched /bin/ps on NetBSD
>=20
> % ./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
>=20
> % ./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
>=20
> % ./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
>=20
> Any comments? Please Cc: me on replies, I'm off the list.
>=20
> Thanks and have a nice day
>=20
> --=20
> Martin Ma=E8ok http://underground.cz/
> martin.macok@underground.cz http://Xtrmntr.org/ORBman/
>=20
--=20
Jaromir Dolecek <jdolecek@NetBSD.org> http://www.NetBSD.org/Ports/i386/ps2.=
html
-=3D Those who would give up liberty for a little temporary safety deserve=
=3D-
-=3D neither liberty nor safety, and will lose both. -- Benjamin Franklin=
=3D-