Subject: Re: ps(1) sysv silliness
To: None <tech-userlevel@netbsd.org>
From: Simon Burge <simonb@netbsd.org>
List: tech-userlevel
Date: 06/08/2000 13:50:17
ITOH Yasufumi wrote:

> simonb@netbsd.org writes:
> > Ummm:
> > 
> > 	alpha:~ 6> ps Uroot
> > 	PID TT STAT    TIME COMMAND
> > 	198 E0 Is+  0:00.02 /usr/libexec/getty std.9600 console 
> > 	alpha:~ 7> ps -Uroot
> > 	PID TT STAT    TIME COMMAND
> > 	198 E0 Is+  0:00.02 /usr/libexec/getty std.9600 console 
> 
> Ummmm,
> 	pino% ps Uroot
> 	ps: rooT: illegal user name
> 	pino%
> 
> Does your machine have a user named "rooT"?

Ahh, well I sort of have a user "rooT" - I use hesiod over DNS for
passwd:

	alpha:src/bin/ps 14> host -c hs -t txt rooT.passwd.supp.cpr.itg.telecom.com.au.
	rooT.passwd.supp.cpr.itg.telecom.com.au descriptive text "root:xxxxxxxxxxxxx:0:1:Da Boss:/:/bin/tcsh"

It looks like the problem is in ps.c around:

    480         /*
    481          * if last letter is a 't' flag with no argument (in the context
    482          * of the oldps options -- option string NOT starting with a '-' --
    483          * then convert to 'T' (meaning *this* terminal, i.e. ttyname(0)).
    484          */
    485         if (*cp == 't' && *s != '-')
    486                 *cp = 'T';
    487         else {

And the fix will involve some of the logic from around line 503 as well.
I'll look into it further...

Simon.