threads / discuss / 1860

What shall we do with the GECOS field again?

Subject: What shall we do with the GECOS field again?

## tl;dr

20 messages between Sep 19, 2005 and Sep 20, 2005.

replies: 19people: 8as markdown or json

Petr Baudis· Sep 19, 2005, 13:48 UTC · lore
  Hello,
  after today's another confrontation with angry mob of real-world
Cogito users, I decided to revive the old discussion about what part of
the GECOS field should be used to prefill GIT_*_NAME. Linus stated in
<Pine.LNX.4.58.0504171636590.7211@ppc970.osdl.org> that he does not want
to cut based on ',', because it might throw away the first name of gecos
fields in the "Torvalds, Linus" name.
  Well, I have to say that from the GECOS fields I saw, none use that
format, but a lot of them used the realname,phone,something,phone,...
format. The other point is, that users usually do not expect their phone
number to end up in their name information in GIT commits, which results
in a very unpleasant surprise (doubly so due to the immutable GIT
nature). Yes, they should check after the first commit if they are happy
with everything, and yes, GECOS is world-readable and therefore they
shouldn't put information they don't want to be public to it. Still they
do and I think GIT shouldn't make them unpleasant surprises.
  So my proposal (patch will follow soon) is to cut everything after the
first , or ; from the GECOS field. These are the usual delimiters used
in the GECOS field, and hopefully this will prevent polluting the
realname fields of commit headers with crap and surprising the users.
In the (I think rather rare) situation of the "Baudis, Petr"-like GECOS
fields, this will just result in only the surname being in the realname
field, which seems to be much less harmful and comparably less evil to
me. 
  Opinions?
-- 
				Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
If you want the holes in your knowledge showing up try teaching
someone.  -- Alan Cox
Kevin O'Riordan· Sep 19, 2005, 14:11 UTC · re: Petr Baudis · lore

Re: What shall we do with the GECOS field again?

Hi,
> [cutting] based on ',', ... might throw away the first name of gecos
> fields in the "Torvalds, Linus" name.
...
> ... a lot of them used the realname,phone,something,phone,... format.
...
> So my proposal ... is to cut everything after the first , or ; from
> the GECOS field.
...
> In the ... situation of the "Baudis, Petr"-like GECOS fields, this
> will just result in only the surname being in the realname field,
> which seems to be much less harmful and comparably less evil to me. 

In case this hasn't been suggested, how about cutting on "," but taking the first and second fields instead of just the first, and then discarding the second if it contains numbers (or is empty, or whatever) ?

-kor
Matthias Urlichs· Sep 19, 2005, 14:34 UTC · re: Kevin O'Riordan · lore

Re: What shall we do with the GECOS field again?

Hi, Kevin O'Riordan wrote:
> In case this hasn't been suggested, how about cutting on "," but taking
> the first and second fields instead of just the first, and then
> discarding the second if it contains numbers (or is empty, or whatever) ?
... or contains a room name or a street or ...  Bah.

*If* we want heuristics, then I'd check for the presence of more than one semicolon or comma (semicolon to be checked first). Yes => use the part before the semicolon or comma. No => use the whole field.

However, I'd argue that we don't want heuristics, we should cut at the first delimiter, and anybody who wants to change their commit info gets to set an envvar.

-- 
Matthias Urlichs   |   {M:U} IT Design @ m-u-it.de   |  smurf@smurf.noris.de
Disclaimer: The quote was selected randomly. Really. | http://smurf.noris.de
 - -
I've got a patent pending on swallowing, oxidation, and chewing gum.
A Large Angry SCM· Sep 19, 2005, 14:30 UTC · re: Petr Baudis · lore

Re: What shall we do with the GECOS field again?

Petr Baudis wrote:
Show 30 quoted lines
>   Hello,
> 
>   after today's another confrontation with angry mob of real-world
> Cogito users, I decided to revive the old discussion about what part of
> the GECOS field should be used to prefill GIT_*_NAME. Linus stated in
> <Pine.LNX.4.58.0504171636590.7211@ppc970.osdl.org> that he does not want
> to cut based on ',', because it might throw away the first name of gecos
> fields in the "Torvalds, Linus" name.
> 
>   Well, I have to say that from the GECOS fields I saw, none use that
> format, but a lot of them used the realname,phone,something,phone,...
> format. The other point is, that users usually do not expect their phone
> number to end up in their name information in GIT commits, which results
> in a very unpleasant surprise (doubly so due to the immutable GIT
> nature). Yes, they should check after the first commit if they are happy
> with everything, and yes, GECOS is world-readable and therefore they
> shouldn't put information they don't want to be public to it. Still they
> do and I think GIT shouldn't make them unpleasant surprises.
> 
>   So my proposal (patch will follow soon) is to cut everything after the
> first , or ; from the GECOS field. These are the usual delimiters used
> in the GECOS field, and hopefully this will prevent polluting the
> realname fields of commit headers with crap and surprising the users.
> In the (I think rather rare) situation of the "Baudis, Petr"-like GECOS
> fields, this will just result in only the surname being in the realname
> field, which seems to be much less harmful and comparably less evil to
> me. 
> 
>   Opinions?
> 
Petr,

Your view of GECOS field contents (formatting) does not match my experience. Many organizations, both large and small, have standards and requirements for the contents and formatting of information in the GECOS field. Saying that the user's name is first and a particular punctuation character SHALL be the standard cut point and everyone not happy with the results should explicitly set the Git environment variables is the wrong approach.

A better approach is to not use the GECOS field contents at all and force everyone the set the Git environment variables, AND/OR to include the what Git thinks the user's name name might be in the commit message template they're editing (like the file list).

Matthias Urlichs· Sep 19, 2005, 14:47 UTC · re: A Large Angry SCM · lore

Re: What shall we do with the GECOS field again?

Hi, A Large Angry SCM wrote:
> Saying that the user's name is first and a particular punctuation 
> character SHALL be the standard cut point and everyone not happy with 
> the results should explicitly set the Git environment variables is the 
> wrong approach.
I disagree. Standard add-user tools use the gecos field in one of two ways:
- fullname
- fullname,and,some,other,cruft

Sure, many organizations bake their own, but I'd argue that the majority doesn't.

> AND/OR to include 
> the what Git thinks the user's name name might be in the commit message
> template they're editing (like the file list).

I think that's a good idea, as long as people are told how to change it (i.e., an envvar -- NOT by editing the file).

-- 
Matthias Urlichs   |   {M:U} IT Design @ m-u-it.de   |  smurf@smurf.noris.de
Disclaimer: The quote was selected randomly. Really. | http://smurf.noris.de
 - -
On those occasions when the angel managed to get his mind into the
twentieth century, it always gravitated to 1950.
        -- (Terry Pratchett & Neil Gaiman, Good Omens)
A Large Angry SCM· Sep 19, 2005, 16:16 UTC · re: Matthias Urlichs · lore

Re: What shall we do with the GECOS field again?

Matthias Urlichs wrote:
Show 8 quoted lines
> Hi, A Large Angry SCM wrote:
> 
>>Saying that the user's name is first and a particular punctuation 
>>character SHALL be the standard cut point and everyone not happy with 
>>the results should explicitly set the Git environment variables is the 
>>wrong approach.
> 
> I disagree. Standard add-user tools use the gecos field in one of two ways:
s/two/many/
> - fullname
> - fullname,and,some,other,cruft
- title,name and other stuff
- department, name and other stuff
- other punctuation, etc.
> 
> Sure, many organizations bake their own, but I'd argue that the majority
> doesn't.

The point is we should not be telling them what and how to put stuff in the GECOS field.

Show 6 quoted lines
>>AND/OR to include 
>>the what Git thinks the user's name name might be in the commit message
>>template they're editing (like the file list).
> 
> I think that's a good idea, as long as people are told how to change it
> (i.e., an envvar -- NOT by editing the file).
Yes.
Petr Baudis· Sep 19, 2005, 16:34 UTC · re: A Large Angry SCM · lore

Re: What shall we do with the GECOS field again?

Dear diary, on Mon, Sep 19, 2005 at 06:16:47PM CEST, I got a letter where A Large Angry SCM <gitzilla@gmail.com> told me that...

Show 5 quoted lines
> >Sure, many organizations bake their own, but I'd argue that the majority
> >doesn't.
> 
> The point is we should not be telling them what and how to put stuff in 
> the GECOS field.

The point is that our guess should be something which works for the most people.

Show 8 quoted lines
> >>AND/OR to include 
> >>the what Git thinks the user's name name might be in the commit message
> >>template they're editing (like the file list).
> >
> >I think that's a good idea, as long as people are told how to change it
> >(i.e., an envvar -- NOT by editing the file).
> 
> Yes.

I'll change cg-commit to always include the name/email fields in its template. I think it's verbose enough as it is now, though, and I don't want it to bloat it with more generic help text. I've expanded the documentation of cg-commit on the GIT_ variables and that ought to be enough. :-)

-- 
				Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
If you want the holes in your knowledge showing up try teaching
someone.  -- Alan Cox
Junio C Hamano· Sep 19, 2005, 16:06 UTC · re: Petr Baudis · lore

Re: What shall we do with the GECOS field again?

Petr Baudis <pasky@suse.cz> writes:
>   Well, I have to say that from the GECOS fields I saw, none use that
> format, but a lot of them used the realname,phone,something,phone,...
> format.
>   Opinions?

If the real world GECOS were either only plain and name,room,blah,... format as you say and assume I think a heuristics like you suggested would be better than the current heuristics of assuming everything is a name, but I haven't seen what "angry mob" actually has so cannot judge.

What do popular MUAs do to come up with the real-name fields? Don't they face the same problem, trying to using GECOS?

Petr Baudis· Sep 19, 2005, 16:16 UTC · re: Junio C Hamano · lore

Re: What shall we do with the GECOS field again?

Dear diary, on Mon, Sep 19, 2005 at 06:06:21PM CEST, I got a letter where Junio C Hamano <junkio@cox.net> told me that...

Show 13 quoted lines
> Petr Baudis <pasky@suse.cz> writes:
> 
> >   Well, I have to say that from the GECOS fields I saw, none use that
> > format, but a lot of them used the realname,phone,something,phone,...
> > format.
> 
> >   Opinions?
> 
> If the real world GECOS were either only plain and
> name,room,blah,... format as you say and assume I think a
> heuristics like you suggested would be better than the
> current heuristics of assuming everything is a name, but I
> haven't seen what "angry mob" actually has so cannot judge.
It uses the name,room,blah,... format.
> What do popular MUAs do to come up with the real-name fields?
> Don't they face the same problem, trying to using GECOS?
mutt:
  { "gecos_mask",       DT_RX,   R_NONE, UL &GecosMask, UL "^[^,]*" },

A regular expression used by mutt to parse the GECOS field of a password entry when expanding the alias. By default the regular expression is set to "^[^,]*" which will return the string up to the first "," encountered. If the GECOS field contains a string like "lastname, firstname" then you should set the gecos_mask=".*".

-- 
				Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
If you want the holes in your knowledge showing up try teaching
someone.  -- Alan Cox
Linus Torvalds· Sep 19, 2005, 16:32 UTC · re: Junio C Hamano · lore

Re: What shall we do with the GECOS field again?

On Mon, 19 Sep 2005, Junio C Hamano wrote:
> 
> What do popular MUAs do to come up with the real-name fields?
> Don't they face the same problem, trying to using GECOS?
Since I have my pine installed in git, I could git grep it. It says
    /* full name is all chars up to first ',' (or whole gcos, if no ',') */
    /* replace any & with logname in upper case */
I don't know why the & rule, but there you have it..
The Perl User::pwent module seems to agree, btw (also about '&'):
   "Interpretation of the gecos field varies between systems, but
    traditionally holds 4 comma-separated fields containing the user's
    full name, office location, work phone number, and home phone number.  
    An & in the gecos field should be replaced by the user's properly
    capitalized login name."

I still worry about names of the type "Torvalds, Linus", but maybe that's just not an issue.

		Linus
Junio C Hamano· Sep 19, 2005, 16:49 UTC · re: Linus Torvalds · lore

Re: What shall we do with the GECOS field again?

Linus Torvalds <torvalds@osdl.org> writes:
Show 8 quoted lines
> The Perl User::pwent module seems to agree, btw (also about '&'):
>
>    "Interpretation of the gecos field varies between systems, but
>     traditionally holds 4 comma-separated fields containing the user's
>     full name, office location, work phone number, and home phone number.  
>
>     An & in the gecos field should be replaced by the user's properly
>     capitalized login name."

I vaguelly recall seeing that & somewhere and wondering what they do with mcdonalds ;-)

> I still worry about names of the type "Torvalds, Linus", but maybe that's 
> just not an issue.

Does not appear to be. So I'd vote for us doing the "cut at first comma, substitute & with toupper(login[0])+login[1..]".

Linus Torvalds· Sep 19, 2005, 16:59 UTC · re: Junio C Hamano · lore

Re: What shall we do with the GECOS field again?

On Mon, 19 Sep 2005, Junio C Hamano wrote:
> 
> I vaguelly recall seeing that & somewhere and wondering what
> they do with mcdonalds ;-)

Pine uppercases _all_ of the login field. So mcdonalds would be MCDONALDS. Which isn't much better than Mcdonalds, but might explain people out there with all-upcase last names.

		Linus
Ryan Anderson· Sep 20, 2005, 04:02 UTC · re: Linus Torvalds · lore

Re: What shall we do with the GECOS field again?

On Mon, Sep 19, 2005 at 09:59:42AM -0700, Linus Torvalds wrote:
Show 8 quoted lines
> On Mon, 19 Sep 2005, Junio C Hamano wrote:
> > 
> > I vaguelly recall seeing that & somewhere and wondering what
> > they do with mcdonalds ;-)
> 
> Pine uppercases _all_ of the login field. So mcdonalds would be MCDONALDS. 
> Which isn't much better than Mcdonalds, but might explain people out 
> there with all-upcase last names.

I think that's more of an Asian response to the confusion westerners have with "family name" vs "given name" and "first name" vs "last name". The simple solution is to convert the "family" name to all upper case and then whatever order is used is no longer ambiguous (assuming you know the convention).

That, at least, is my conclusion from seeing Japanese business cards.
I could be totally wrong, of course.
-- 
Ryan Anderson
  sometimes Pug Majere
Linus Torvalds· Sep 20, 2005, 04:13 UTC · re: Ryan Anderson · lore

Re: What shall we do with the GECOS field again?

On Tue, 20 Sep 2005, Ryan Anderson wrote:
Show 8 quoted lines
> On Mon, Sep 19, 2005 at 09:59:42AM -0700, Linus Torvalds wrote:
>
> > Pine uppercases _all_ of the login field. So mcdonalds would be MCDONALDS. 
> > Which isn't much better than Mcdonalds, but might explain people out 
> > there with all-upcase last names.
> 
> I think that's more of an Asian response to the confusion westerners
> have with "family name" vs "given name" and "first name" vs "last name".

I'd believe you, except I have this clear memory of it being pretty common in France too.

I remember it vividly from the original extfs author: Remy CARD. And I don't think that one was the odd man out.

			Linus
Junio C Hamano· Sep 20, 2005, 06:30 UTC · re: Junio C Hamano · lore

Re: What shall we do with the GECOS field again?

Junio C Hamano <junkio@cox.net> writes:
> Does not appear to be.  So I'd vote for us doing the "cut at
> first comma, substitute & with toupper(login[0])+login[1..]".
I've done this in the proposed updates branch.
Nikolai Weibull· Sep 19, 2005, 16:32 UTC · re: Petr Baudis · lore

Re: What shall we do with the GECOS field again?

Petr Baudis wrote:
Show 8 quoted lines
>   So my proposal (patch will follow soon) is to cut everything after the
> first , or ; from the GECOS field. These are the usual delimiters used
> in the GECOS field, and hopefully this will prevent polluting the
> realname fields of commit headers with crap and surprising the users.
> In the (I think rather rare) situation of the "Baudis, Petr"-like GECOS
> fields, this will just result in only the surname being in the realname
> field, which seems to be much less harmful and comparably less evil to
> me. 

If we stop using GECOS, then can we please start using $EMAIL (or perhaps use it regardless of whether we use GECOS or not)? A lot of applications seem to look for $EMAIL and I think that it's universal enough for git to use it as well. To me it seems that both GIT_AUTHOR_NAME, GIT_AUTHOR_EMAIL, GIT_COMMITTER_NAME, and GIT_COMMITTER_EMAIL can use it, as I set $EMAIL as

EMAIL="Nikolai Weibull <something@something.something>"
Perhaps I should provide a patch instead of just putting out requests?,
        nikolai
-- 
Nikolai Weibull: now available free of charge at http://bitwi.se/!
Born in Chicago, IL USA; currently residing in Gothenburg, Sweden.
main(){printf(&linux["\021%six\012\0"],(linux)["have"]+"fun"-97);}
Nikolai Weibull· Sep 19, 2005, 21:21 UTC · re: Nikolai Weibull · lore

Re: What shall we do with the GECOS field again?

Nikolai Weibull wrote:
Show 10 quoted lines
> If we stop using GECOS, then can we please start using $EMAIL (or
> perhaps use it regardless of whether we use GECOS or not)?  A lot of
> applications seem to look for $EMAIL and I think that it's universal
> enough for git to use it as well.  To me it seems that both
> GIT_AUTHOR_NAME, GIT_AUTHOR_EMAIL, GIT_COMMITTER_NAME, and
> GIT_COMMITTER_EMAIL can use it, as I set $EMAIL as
> 
> EMAIL="Nikolai Weibull <something@something.something>"
> 
> Perhaps I should provide a patch instead of just putting out requests?,
Perhaps something like the following patch will do?,
        nikolai
---
diff --git a/ident.c b/ident.c
--- a/ident.c
+++ b/ident.c
@@ -127,18 +127,22 @@ char *get_ident(const char *name, const 
 	char date[50];
 	int i;
 
-	if (!name)
-		name = real_name;
-	if (!email)
-		email = real_email;
+	if (!name && !email && getenv("EMAIL")) {
+		i = copy(buffer, sizeof(buffer), 0, getenv("EMAIL"));
+		i = add_raw(buffer, sizeof(buffer), i, " ");
+	} else {
+		if (!name)
+			name = real_name;
+		if (!email)
+			email = real_email;
+		i = copy(buffer, sizeof(buffer), 0, name);
+		i = add_raw(buffer, sizeof(buffer), i, " <");
+		i = copy(buffer, sizeof(buffer), i, email);
+		i = add_raw(buffer, sizeof(buffer), i, "> ");
+	}
 	strcpy(date, real_date);
 	if (date_str)
 		parse_date(date_str, date, sizeof(date));
-
-	i = copy(buffer, sizeof(buffer), 0, name);
-	i = add_raw(buffer, sizeof(buffer), i, " <");
-	i = copy(buffer, sizeof(buffer), i, email);
-	i = add_raw(buffer, sizeof(buffer), i, "> ");
 	i = copy(buffer, sizeof(buffer), i, date);
 	if (i >= sizeof(buffer))
 		die("Impossibly long personal identifier");
-- 
Nikolai Weibull: now available free of charge at http://bitwi.se/!
Born in Chicago, IL USA; currently residing in Gothenburg, Sweden.
main(){printf(&linux["\021%six\012\0"],(linux)["have"]+"fun"-97);}
Junio C Hamano· Sep 20, 2005, 07:10 UTC · re: Nikolai Weibull · lore

Re: What shall we do with the GECOS field again?

Nikolai Weibull <mailing-lists.git@rawuncut.elitemail.org> writes:
> Perhaps something like the following patch will do?,
>         nikolai
Thanks for the patch.  Some nits and requests.
(1) Proper commit log message here, with your Signed-off-by line.
> +	if (!name && !email && getenv("EMAIL")) {
> +		i = copy(buffer, sizeof(buffer), 0, getenv("EMAIL"));
> +		i = add_raw(buffer, sizeof(buffer), i, " ");
(2) Perhaps have `#define IDENT_ENVIRONMENT "EMAIL"' in cache.h
    and use it, like we do for other environment variables.
(3) Probably you need to validate what is in $EMAIL before
    trusting it, so that we can guard ourselves from EMAIL in a
    format that is suitable for other applications but not for
    us?  If you find that the value does not look good, just
    refuse it with an error message to set more specific
    GIT_{AUTHOR,COMMITTER}_* environment variables.
    Unlike GIT_* environment variables, EMAIL is a convention we
    did not invent ourselves.  We cannot expect it to always be
    formatted to our liking, and more importantly, we should not
    demand the user to set it to the way we like -- the other
    application the user originally set EMAIL for might not like
    what we want.
Junio C Hamano· Sep 20, 2005, 01:53 UTC · re: Nikolai Weibull · lore

Re: What shall we do with the GECOS field again?

Nikolai Weibull <mailing-lists.git@rawuncut.elitemail.org> writes:
Show 6 quoted lines
> If we stop using GECOS, then can we please start using $EMAIL (or
> perhaps use it regardless of whether we use GECOS or not)?  A lot of
> applications seem to look for $EMAIL and I think that it's universal
> enough for git to use it as well.  To me it seems that both
> GIT_AUTHOR_NAME, GIT_AUTHOR_EMAIL, GIT_COMMITTER_NAME, and
> GIT_COMMITTER_EMAIL can use it,...

I am not convinced $EMAIL is used as widely as you claim above (could you give a list of applications please?), but if it is that sounds like a sensible idea.

Nikolai Weibull· Sep 20, 2005, 10:31 UTC · re: Junio C Hamano · lore

Re: What shall we do with the GECOS field again?

Junio C Hamano wrote:
> Nikolai Weibull <mailing-lists.git@rawuncut.elitemail.org> writes:
Show 6 quoted lines
> > If we stop using GECOS, then can we please start using $EMAIL (or
> > perhaps use it regardless of whether we use GECOS or not)?  A lot of
> > applications seem to look for $EMAIL and I think that it's universal
> > enough for git to use it as well.  To me it seems that both
> > GIT_AUTHOR_NAME, GIT_AUTHOR_EMAIL, GIT_COMMITTER_NAME, and
> > GIT_COMMITTER_EMAIL can use it,...
> I am not convinced $EMAIL is used as widely as you claim above (could
> you give a list of applications please?), but if it is that sounds
> like a sensible idea.

I was sadly mistaken. It doesn't seem to be so well-used after all. Here's a list of applications that use it:

* mutt (the only one that really counts)
* darcs (which also uses DARCS_EMAIL)
* various debian utilities (who cares)
* Vim's changelog package (which I have written, so that doesn't count)
Quite a sad list, so I suppose that there's really no point in it...,
        nikolai
-- 
Nikolai Weibull: now available free of charge at http://bitwi.se/!
Born in Chicago, IL USA; currently residing in Gothenburg, Sweden.
main(){printf(&linux["\021%six\012\0"],(linux)["have"]+"fun"-97);}

← back to recent threads