What shall we do with the GECOS field again?
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 <[email protected]> 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?
Signature · 4 lines
Petr "Pasky" Baudis Stuff: http://pasky.or.cz/ If you want the holes in your knowledge showing up try teaching someone. -- Alan Cox
Hi,
Quoted 2 lines
[cutting] based on ',', ... might throw away the first name of gecos fields in the "Torvalds, Linus" name.
...
Quoted 1 line
... a lot of them used the realname,phone,something,phone,... format.
...
Quoted 2 lines
So my proposal ... is to cut everything after the first , or ; from the GECOS field.
...
Quoted 3 lines
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
Quoted 3 lines · Kevin O'Riordan
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.
Signature · 4 lines
Matthias Urlichs | {M:U} IT Design @ m-u-it.de | [email protected]
Disclaimer: The quote was selected randomly. Really. | http://smurf.noris.de
- -
I've got a patent pending on swallowing, oxidation, and chewing gum.Quoted 8 lines · Petr Baudis
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 <[email protected]>"
Perhaps I should provide a patch instead of just putting out requests?,
nikolai
Signature · 3 lines
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);}Quoted 10 lines · Nikolai Weibull
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, andGIT_COMMITTER_EMAILcan use it, as I set $EMAIL asEMAIL="Nikolai Weibull <[email protected]>"
Perhaps I should provide a patch instead of just putting out requests?,
Perhaps something like the following patch will do?,
nikolai
---
ident.c +13 -9
@@ -127,18 +127,22 @@ char *get_ident(const char *name, constchar 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" );
Signature · 3 lines
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);}Quoted 2 lines · Nikolai Weibull
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.
ident.c char *get_ident(const char *name, const · line 132
Quoted 3 lines
ident.c +3
-0+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.
Quoted 6 lines · Nikolai Weibull
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, andGIT_COMMITTER_EMAILcan 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.
Quoted 9 lines · Junio C Hamano
Quoted 6 lines · Nikolai Weibull
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, andGIT_COMMITTER_EMAILcan use it,...
Quoted 3 lines
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
Signature · 3 lines
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);}Quoted 28 lines · Petr Baudis
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 <[email protected]> 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.
Quoted 2 lines
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).
Quoted 4 lines · A Large Angry SCM
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.
Quoted 3 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).
Signature · 6 lines
Matthias Urlichs | {M:U} IT Design @ m-u-it.de | [email protected]
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)Quoted 5 lines · Matthias Urlichs
Quoted 1 line · A Large Angry SCM
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/
Quoted 2 lines
- fullname
- fullname,and,some,other,cruft
- title,name and other stuff
- department, name and other stuff
- other punctuation, etc.
Quoted 3 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.
Quoted 5 lines
Quoted 2 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.
Dear diary, on Mon, Sep 19, 2005 at 06:16:47PM CEST, I got a letter where A Large Angry SCM <[email protected]> told me that...
Quoted 5 lines
Quoted 2 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.
Quoted 8 lines
Quoted 6 lines
Quoted 3 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. :-)
Signature · 4 lines
Petr "Pasky" Baudis Stuff: http://pasky.or.cz/ If you want the holes in your knowledge showing up try teaching someone. -- Alan Cox
Quoted 5 lines · Petr Baudis
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?
Dear diary, on Mon, Sep 19, 2005 at 06:06:21PM CEST, I got a letter where Junio C Hamano <[email protected]> told me that...
Quoted 6 lines
Quoted 3 lines · Petr Baudis
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.
Quoted 7 lines
Quoted 1 line
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.
Quoted 2 lines
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=".*".
Signature · 4 lines
Petr "Pasky" Baudis Stuff: http://pasky.or.cz/ If you want the holes in your knowledge showing up try teaching someone. -- Alan Cox
Quoted 3 lines · Junio C Hamano
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
Quoted 8 lines · Linus Torvalds
The Perl
User::pwentmodule 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 ;-)
Quoted 2 lines
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..]".
Quoted 7 lines · Junio C Hamano
Quoted 6 lines · Linus Torvalds
The Perl
User::pwentmodule 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.
Quoted 5 lines
Quoted 2 lines
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 ;-)
You can't use it in that case.
Quoted 5 lines
Quoted 2 lines
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..]".
That is exactly the intent.
Signature · 4 lines
Dr. Horst H. von Brand User #22616 counter.li.org Departamento de Informatica Fono: +56 32 654431 Universidad Tecnica Federico Santa Maria +56 32 654239 Casilla 110-V, Valparaiso, Chile Fax: +56 32 797513
Quoted 2 lines · Junio C Hamano
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.
Quoted 3 lines · Junio C Hamano
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
Quoted 8 lines · Linus Torvalds
Quoted 3 lines · Junio C Hamano
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.
Signature · 2 lines
Ryan Anderson sometimes Pug Majere
Quoted 8 lines · Ryan Anderson
Quoted 3 lines · Linus Torvalds
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