ps and username size
Tito
farmatito at tiscali.it
Thu Jan 10 14:07:25 PST 2008
On Thursday 10 January 2008 22:40:26 Cristian Ionescu-Idbohrn wrote:
> On Thu, 10 Jan 2008, Tito wrote:
>
> > Isn't there a maximum lenght for usernames on unix/linux?
> > Would it make sense to set the width of this field to that value?
>
> Doing so seems like the clever thing to do, though you'd run into a
> columnisation problem and loose compatibility to full version of the app.
>
> > I ask this because on my system (Ubuntu 7.10 - more or less)
> > adduser fails with usernames longer than 32 chars.
> >
> > Adding user `qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq' ...
> > Adding new group `qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq' (1006) ...
> > groupadd: qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq is not a valid group name
> > adduser: `/usr/sbin/groupadd -g 1006 qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq' returned error code 3. Exiting.
>
> 32 chars seems reasonable, but display real estate seems to be a problem.
> I believe truncated usernames vs. option to display user ids only seems to
> be an acceptable compromise. What do you think?
>
>
> Cheers,
>
Hi,
of course it is acceptable.
OTOH it doesn't solve the problem of a possible ambiguity
between username and uid as names composed only of digits
are legal.
One simple idea to solve this would be to prepend uid=
when using uids instead of to long usernames.
root 6643 0.0 0.0 13120 1564 ? Ss 20:40 0:00 /usr/sbin/gdm
root 6652 0.0 0.0 13564 2868 ? S 20:40 0:00 /usr/sbin/gdm
root 6654 1.2 1.5 68216 63216 tty7 SLs+ 20:40 1:49 /usr/bin/X :0 -
uid=440 11376 0.0 0.0 4140 1760 pts/2 Ss 22:54 0:00 /bin/bash
dnsmasq 6671 0.0 0.0 2236 772 ? S 20:40 0:00 /usr/sbin/dnsma
root 6722 0.0 0.0 2828 684 ? Ss 20:40 0:00 /usr/bin/dirmng
The pros:
1) the prefix is short and plus the size for the uid will not use more than (uid=65000) 9-10 chars field width.
2) the = sign is not allowed in usernames so no more ambiguity.
adduser uid=123
adduser: To avoid problems, the username should consist only of
letters, digits, underscores, periods, at signs and dashes, and not start with
a dash (as defined by IEEE Std 1003.1-2001). For compatibility with Samba
machine accounts $ is also supported at the end of the username
The contras:
1) this breaks all standards of the world and the compatibility with gnu ps.
Just one more idea :-)
Ciao,
Tito
More information about the busybox
mailing list