On Thu, Nov 01, 2018 at 09:04:03PM +0100, Klemens Nanni wrote: > On Thu, Nov 01, 2018 at 02:56:38PM -0400, Ted Unangst wrote: > > this looks to be in the wrong order. if 1000 is a username, that should be > > matched first before numeric lookup. > Preferring UIDs indeed clobbers usernames with the respective numerical > username. > > However, other parts in base such as getent(1) treat UIDs with higher > priority and behave like that already: > > $ doas useradd -- 1000 > useradd: Warning: home directory `/home/1000' doesn't exist, and -m was > not specified > $ getent passwd 1000 > kn:*:1000:1000:Klemens Nanni:/home/kn:/bin/ksh > $ getent passwd $(id -u 1000) > 1000:*:1003:1003::/home/1000:/bin/ksh > > Here's a diff that tries UIDs only if username lookup fails. > > Index: top.1 > =================================================================== > RCS file: /cvs/src/usr.bin/top/top.1,v > retrieving revision 1.69 > diff -u -p -r1.69 top.1 > --- top.1 25 Jul 2018 17:24:14 -0000 1.69 > +++ top.1 1 Nov 2018 20:01:02 -0000 > @@ -182,8 +182,7 @@ Show only those processes owned by > The prefix > .Sq - > hides processes owned by that user. > -This option currently only accepts usernames and does not understand > -UID numbers. > +This option accepts usernames and UID numbers. > .It Fl u > Do not take the time to map UID numbers to usernames. > Normally,
hi. while with the current behaviour it made sense to document it that way, once you change it, it just sounds odd. it should really be wrapped into the first sentence. sth like: Show only those processes owned by username or UID .Ar user . jmc