{"thread":{"id":"8910","subject":"[PATCH] Use /etc/mailname for the hostname part of the email address.","startedAt":"2007-07-07T02:21:05Z","lastAt":"2007-07-07T06:07:42Z","messageCount":3,"participants":["Matt Kraai","Linus Torvalds","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"46672","messageId":"11837748652889-git-send-email-kraai@ftbfs.org","threadId":"8910","inReplyTo":null,"subject":"[PATCH] Use /etc/mailname for the hostname part of the email address.","fromName":"Matt Kraai","fromEmail":"kraai@ftbfs.org","sentAt":"2007-07-07T02:21:05Z","receivedAt":"2007-07-07T02:21:05Z","isPatch":true,"sender":{"key":"kraai@ftbfs.org","avatar":null},"body":"From: Matt Kraai <kraai@asturias.ftbfs.org>\n\n/etc/mailname contains the hostname to be used on outgoing email\nmessages generated locally on Debian systems (cf.\nhttp://www.debian.org/doc/debian-policy/ch-customized-programs.html).\nIf it available, use it instead of gethostname or gethostbyname.\n\nSigned-off-by: Matt Kraai <kraai@ftbfs.org>\n---\n\n\tIf this is only appropriate for the Debian package, I\n\tapologize.  Please let me know if this is the case and I'll\n\tsubmit it to the Debian maintainer.\n\n ident.c |   26 +++++++++++++++++++++++++-\n 1 files changed, 25 insertions(+), 1 deletions(-)\n\ndiff --git a/ident.c b/ident.c\nindex 6612d17..3d05ae2 100644\n--- a/ident.c\n+++ b/ident.c\n@@ -43,6 +43,27 @@ static void copy_gecos(const struct passwd *w, char *name, size_t sz)\n \n }\n \n+static int getmailname(char *name, size_t len)\n+{\n+\tFILE *f = fopen(\"/etc/mailname\", \"r\");\n+\tint i;\n+\n+\tif (!f)\n+\t\treturn -1;\n+\tif (!fgets(name, len, f)) {\n+\t\tfclose(f);\n+\t\treturn -1;\n+\t}\n+\tfclose(f);\n+\tfor (i = 0; !isspace(name[i]); i++)\n+\t\t;\n+\tif (name[i - 1] != '.')\n+\t\tname[i] = '\\0';\n+\telse\n+\t\tname[i - 1] = '\\0';\n+\treturn 0;\n+}\n+\n static void copy_email(const struct passwd *pw)\n {\n \t/*\n@@ -54,7 +75,10 @@ static void copy_email(const struct passwd *pw)\n \t\tdie(\"Your sysadmin must hate you!\");\n \tmemcpy(git_default_email, pw->pw_name, len);\n \tgit_default_email[len++] = '@';\n-\tgethostname(git_default_email + len, sizeof(git_default_email) - len);\n+\tif (getmailname(git_default_email + len,\n+\t\t\tsizeof(git_default_email) - len) < 0)\n+\t\tgethostname(git_default_email + len,\n+\t\t\t    sizeof(git_default_email) - len);\n \tif (!strchr(git_default_email+len, '.')) {\n \t\tstruct hostent *he = gethostbyname(git_default_email + len);\n \t\tchar *domainname;\n-- \n1.5.2.3\n"},{"id":"46674","messageId":"alpine.LFD.0.999.0707061945220.31544@woody.linux-foundation.org","threadId":"8910","inReplyTo":"11837748652889-git-send-email-kraai@ftbfs.org","subject":"Re: [PATCH] Use /etc/mailname for the hostname part of the email address.","fromName":"Linus Torvalds","fromEmail":"torvalds@linux-foundation.org","sentAt":"2007-07-07T02:54:34Z","receivedAt":"2007-07-07T02:54:34Z","isPatch":true,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\n\nOn Fri, 6 Jul 2007, Matt Kraai wrote:\n>\n> From: Matt Kraai <kraai@asturias.ftbfs.org>\n> \n> /etc/mailname contains the hostname to be used on outgoing email\n> messages generated locally on Debian systems\n\nI think this is taking us into a bad direction.\n\nThe thing is, I actually personally tend to _prefer_ the committer name as \nbeing \"user@hostname\" rather than a \"real\" email address.\n\nIt often tells you something much more.\n\nFor example, take a look at the kernel archive, and do\n\n\tgit log --author=torvalds\n\nand notice how the exact author string changes - not just because \n\"osdl.org\" became \"linux-foundation.org\", but because it ends up encoding \nwhich *machine* I did things on.\n\nFor example, while I do almost all my work at any time on my \"main\" \nmachine (right now \"woody\" - not because I'm horny, but because it's an \nIntel woodcrest machine, the way my previous main machine was called \"g5\" \nbecause it was an IBM PowerPC G5 machine), but I sometimes do things on \nanother machine because that's the machine that showed the problem, or was \nthe machine that it got tested on (32-bit x86 things: \"macmini\" or \"evo\"), \nor it was just the laptop I use while travelling (\"evo\" again).\n\nIOW, I don't think the authorship really even _has_ to be seen as a \"real \nemail\" address. The \"user@hostname\" in many ways is nicer. Sure, when the \npatches come in as emails (which ends up being most of them), it obviously \nends up being the email, but I don't think that's at all required.\n\nIf you actually want to contact the people involved with a patch, you \nshould use the \"Signed-off-by:\" and \"Cc:\" lines in the commit message, not \nnecessarily the author thing!\n\n\t\t\tLinus\n"},{"id":"46677","messageId":"7vabu8d9w1.fsf@assigned-by-dhcp.cox.net","threadId":"8910","inReplyTo":"alpine.LFD.0.999.0707061945220.31544@woody.linux-foundation.org","subject":"Re: [PATCH] Use /etc/mailname for the hostname part of the email address.","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2007-07-07T06:07:42Z","receivedAt":"2007-07-07T06:07:42Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Linus Torvalds <torvalds@linux-foundation.org> writes:\n\n> The thing is, I actually personally tend to _prefer_ the committer name as \n> being \"user@hostname\" rather than a \"real\" email address.\n>\n> It often tells you something much more.\n\nI remember you said exactly the same thing before.  But I wonder\nif \"committer\" e-mail address is really the place you would want\nto use as (one of) the source of reliable information for that\nkind of thing.  The information obviously can be used among\npeople who exchange commits via git-pull, but what about people\nwhose changes are always fed as e-mailed patches?\n\nFor such people, if they would want to encode the auxiliary\ninformation in their author name like you do with g5 and woody,\nwould you recommend they put the in-body From: header, which may\nnot be working e-mail addresses to reach them?\n"}]}