On Mon, 18 Nov 2024 22:05:28 +0100
Xabier Oneca -- xOneca wrote:
> Hi 'fossd',
>
> > Pre-configuring "Linux User" as Full Name is confusing a lot of users
> > downstream.[1] For example, in geary e-mails were sent out as "Linux
> > User"[2] and I also saw a couple of git commits with this name. This name
> > does not bring any more improvements than just leaving this field
> > empty, and let applications most likely fallback to the username.
> >
> > Alternative would be to set the field to `&` (Capitalized username,
> > according to passwd(5)) or that we just set the GECOS field downstream.
> >
> > [1] https://gitlab.postmarketos.org/postmarketOS/pmbootstrap/-/issues/2214
> > [2] https://gitlab.gnome.org/GNOME/geary/-/issues/1486
> >
> > Signed-off-by: fossdd
> > ---
> > loginutils/adduser.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/loginutils/adduser.c b/loginutils/adduser.c
> > index d3c795afa..c0dc845a2 100644
> > --- a/loginutils/adduser.c
> > +++ b/loginutils/adduser.c
> > @@ -196,7 +196,7 @@ int adduser_main(int argc UNUSED_PARAM, char **argv)
> >
> > bb_simple_error_msg_and_die(bb_msg_perm_denied_are_you_root);
> > }
> >
> > - pw.pw_gecos = (char *)"Linux User,,,";
> > + pw.pw_gecos = (char *)",,,";
>
> I would just, as well, leave the GECOS field entirely empty for that
> effect. The commas do not contribute anything useful.
>
> Cheers,
>
> Xabier Oneca_,,_
Hi,
man 5 passwd says:
" The comment field, also known as the gecos field, is used by various system
utilities, such as finger(1).
The use of an ampersand here will be replaced by the capitalised login name
when the field is used or displayed by
such system utilities."
and in Wikipedia:
"The gecos field, or GECOS field, is a field in each record in the /etc/passwd
file on Unix and similar operating systems. On UNIX, it is the 5th of 7 fields
in a record.
It is typically used to record general information about the account or its
user(s) such as their real name and phone number.
Format
The typical format for the GECOS field is a comma-delimited list with this
order:
1) User's full name (or application name, if the account is for a program)
2) Building and room number or contact person
3) Office telephone number
4) Home telephone number
5) Any other contact information (pager number, fax, external e-mail
address, etc.)
In most UNIX systems non-root users can change their own information using the
chfn or chsh command. "
Where GECOS are divided as:
:FullName,RoomAddress,WorkPhone,HomePhone,Others:
And Others are divided in as many commas as you like:
:FullName,RoomAddress,WorkPhone,HomePhone,Other1,Other2,Other3:
For the record : GECOS stands for "General Electric Comprehensive Operating
System".
So I would suggest one ampersand and four commas:
pw.pw_gecos = (char *)"&";
but acceptable would also be:
pw.pw_gecos = (char *)"&";
for the sake of space saving because the finger client command which is the
de facto authoritative source of information for gecos field formatting
nowadays (together with sendmail) follows this rules in most Unix-like OS:
1) Ampersands should only be expanded in the first comma-delimited subfield
(i.e. the so-called "full name" or "real name" subfield).
2) If there are no commas in the GECOS field, treat the entire field as the
real name.
3) Any and all ampersands are expanded, not only the first one.
4) If the first character of the username is an ASCII lowercase letter, that
letter is uppercased in the ampersand expansion.
Otherwise it is left intact. No case conversion is done to characters
other than the first one.
Even better to be picky would be ampersand for normal users and empty gecos as
default for system users.
Ciao,
Tito
___
busybox mailing list
busybox@busybox.net
https://lists.busybox.net/mailman/listinfo/busybox