Subject: Re: trailing commas in GECOS field with chfn
To: Jeremy C. Reed <reed@reedmedia.net>
From: Rasputin <rasputin@idoru.mine.nu>
List: netbsd-users
Date: 07/11/2002 21:19:48
* Jeremy C. Reed <reed@reedmedia.net> [020711 17:55]:
> On Thu, 11 Jul 2002, Rasputin wrote:
> 
> > Are these annoying anyone else :) ?
> 
> I didn't notice it.
> 
> > rasputin:*:<UID>:<GID>:Rasputin,,,:<HOMEDIR>:<SHELL>
> >
> > (if you leave your phone nunmber, etc blank)
> >
> > This 'trailing comma' pattern looks a bit rough in mails, etc.
> 
> Strange. What applications? For example, pine doesn't include my ",,," in
> my name (even though it is in gecos field.)

I first noticed it in the root mails that cron generates, and another user
on my box noticed mutt also them.

He reckons OpenBSD does the same, but FreeBSD has fixed it.

> But getpwnam(3) (and getpwuid) do return a gecos with commas if it is in
> it. So I guess some applications clean up and some don't.
> 
> > I've attached a little patch to fix it [1], but wondered if it
> > would break anything?
> 
> Instead of removing the commas afterwards, just don't add (snprintf) all
> that info unless each exists first.

Yeah, could do - I also thought of apppending a comma to each field and 
then pruning any string that were just ( ',', '\0') ... but that's a bit of a hack.

> > I'm only halfway through K&R chapter 2.
 
> Have fun.

Oh, I am :) 

( /me slopes off to see how ps(1) works.... )

>    Jeremy C. Reed
>    http://www.reedmedia.net/

-- 
Rasputin :: Jack of All Trades - Master of Nuns