* [PATCH] Use /etc/mailname for the hostname part of the email address.
@ 2007-07-07 2:21 Matt Kraai
2007-07-07 2:54 ` Linus Torvalds
0 siblings, 1 reply; 3+ messages in thread
From: Matt Kraai @ 2007-07-07 2:21 UTC (permalink / raw)
To: git; +Cc: Matt Kraai, Matt Kraai
From: Matt Kraai <kraai@asturias.ftbfs.org>
/etc/mailname contains the hostname to be used on outgoing email
messages generated locally on Debian systems (cf.
http://www.debian.org/doc/debian-policy/ch-customized-programs.html).
If it available, use it instead of gethostname or gethostbyname.
Signed-off-by: Matt Kraai <kraai@ftbfs.org>
---
If this is only appropriate for the Debian package, I
apologize. Please let me know if this is the case and I'll
submit it to the Debian maintainer.
ident.c | 26 +++++++++++++++++++++++++-
1 files changed, 25 insertions(+), 1 deletions(-)
diff --git a/ident.c b/ident.c
index 6612d17..3d05ae2 100644
--- a/ident.c
+++ b/ident.c
@@ -43,6 +43,27 @@ static void copy_gecos(const struct passwd *w, char *name, size_t sz)
}
+static int getmailname(char *name, size_t len)
+{
+ FILE *f = fopen("/etc/mailname", "r");
+ int i;
+
+ if (!f)
+ return -1;
+ if (!fgets(name, len, f)) {
+ fclose(f);
+ return -1;
+ }
+ fclose(f);
+ for (i = 0; !isspace(name[i]); i++)
+ ;
+ if (name[i - 1] != '.')
+ name[i] = '\0';
+ else
+ name[i - 1] = '\0';
+ return 0;
+}
+
static void copy_email(const struct passwd *pw)
{
/*
@@ -54,7 +75,10 @@ static void copy_email(const struct passwd *pw)
die("Your sysadmin must hate you!");
memcpy(git_default_email, pw->pw_name, len);
git_default_email[len++] = '@';
- gethostname(git_default_email + len, sizeof(git_default_email) - len);
+ if (getmailname(git_default_email + len,
+ sizeof(git_default_email) - len) < 0)
+ gethostname(git_default_email + len,
+ sizeof(git_default_email) - len);
if (!strchr(git_default_email+len, '.')) {
struct hostent *he = gethostbyname(git_default_email + len);
char *domainname;
--
1.5.2.3
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] Use /etc/mailname for the hostname part of the email address.
2007-07-07 2:21 [PATCH] Use /etc/mailname for the hostname part of the email address Matt Kraai
@ 2007-07-07 2:54 ` Linus Torvalds
2007-07-07 6:07 ` Junio C Hamano
0 siblings, 1 reply; 3+ messages in thread
From: Linus Torvalds @ 2007-07-07 2:54 UTC (permalink / raw)
To: Matt Kraai; +Cc: git, Matt Kraai
On Fri, 6 Jul 2007, Matt Kraai wrote:
>
> From: Matt Kraai <kraai@asturias.ftbfs.org>
>
> /etc/mailname contains the hostname to be used on outgoing email
> messages generated locally on Debian systems
I think this is taking us into a bad direction.
The thing is, I actually personally tend to _prefer_ the committer name as
being "user@hostname" rather than a "real" email address.
It often tells you something much more.
For example, take a look at the kernel archive, and do
git log --author=torvalds
and notice how the exact author string changes - not just because
"osdl.org" became "linux-foundation.org", but because it ends up encoding
which *machine* I did things on.
For example, while I do almost all my work at any time on my "main"
machine (right now "woody" - not because I'm horny, but because it's an
Intel woodcrest machine, the way my previous main machine was called "g5"
because it was an IBM PowerPC G5 machine), but I sometimes do things on
another machine because that's the machine that showed the problem, or was
the machine that it got tested on (32-bit x86 things: "macmini" or "evo"),
or it was just the laptop I use while travelling ("evo" again).
IOW, I don't think the authorship really even _has_ to be seen as a "real
email" address. The "user@hostname" in many ways is nicer. Sure, when the
patches come in as emails (which ends up being most of them), it obviously
ends up being the email, but I don't think that's at all required.
If you actually want to contact the people involved with a patch, you
should use the "Signed-off-by:" and "Cc:" lines in the commit message, not
necessarily the author thing!
Linus
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] Use /etc/mailname for the hostname part of the email address.
2007-07-07 2:54 ` Linus Torvalds
@ 2007-07-07 6:07 ` Junio C Hamano
0 siblings, 0 replies; 3+ messages in thread
From: Junio C Hamano @ 2007-07-07 6:07 UTC (permalink / raw)
To: Linus Torvalds; +Cc: Matt Kraai, git, Matt Kraai
Linus Torvalds <torvalds@linux-foundation.org> writes:
> The thing is, I actually personally tend to _prefer_ the committer name as
> being "user@hostname" rather than a "real" email address.
>
> It often tells you something much more.
I remember you said exactly the same thing before. But I wonder
if "committer" e-mail address is really the place you would want
to use as (one of) the source of reliable information for that
kind of thing. The information obviously can be used among
people who exchange commits via git-pull, but what about people
whose changes are always fed as e-mailed patches?
For such people, if they would want to encode the auxiliary
information in their author name like you do with g5 and woody,
would you recommend they put the in-body From: header, which may
not be working e-mail addresses to reach them?
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2007-07-07 6:07 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-07 2:21 [PATCH] Use /etc/mailname for the hostname part of the email address Matt Kraai
2007-07-07 2:54 ` Linus Torvalds
2007-07-07 6:07 ` Junio C Hamano
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox