From: Erik Faye-Lund <kusmabite@googlemail.com>
To: Nicolas Sebrecht <nicolas.s.dev@gmx.fr>
Cc: Frans Pop <elendil@planet.nl>,
Thomas Rast <trast@student.ethz.ch>,
git@vger.kernel.org
Subject: Re: git-send-email generates mail with invalid Message-Id
Date: Tue, 28 Jul 2009 14:10:03 +0200 [thread overview]
Message-ID: <40aa078e0907280510s1afee3ddw3a9333620a3c7d7a@mail.gmail.com> (raw)
In-Reply-To: <40aa078e0907280447p4ed92133jb5e586fb0ca40ef2@mail.gmail.com>
On Tue, Jul 28, 2009 at 1:47 PM, Erik Faye-Lund<kusmabite@googlemail.com> wrote:
> On Tue, Jul 28, 2009 at 1:38 PM, Nicolas Sebrecht<nicolas.s.dev@gmx.fr> wrote:
>> Hum, you're right. The '@' symbol is required, whatever "id-right" is.
>> My previous patch should fix it.
>
> With all due respect, I don't see how that patch fixes anything. The
> previous last-resort solution should already be just as valid, it
> assigns 'user@'+hostname to $du_part. Even if hostname is "" it should
> insert an '@', which didn't happen here.
Here's an attempt to fix the case when Sys::Hostname::hostname returns
"" (domains aren't allowed to be empty if I read RFC2822 correctly).
The problem with the previous attempt was that the earlier if assigned
"user@" to $du_part, so the last if was never entered ($du_part was
always defined).
I generally don't write Perl, so people will most likely barf all over
this one, but at least it should show the concept. It might not even
work.
I also suspect that it is not needed.
http://search.cpan.org/~tty/kurila-1.19_0/ext/Sys-Hostname/Hostname.pm
seems to indicate that it either returns something sensible or dies.
---
Untested.
git-send-email.perl | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/git-send-email.perl b/git-send-email.perl
index 303e03a..baadbdb 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -742,7 +742,11 @@ sub make_message_id
}
if (not defined $du_part or $du_part eq '') {
use Sys::Hostname qw();
- $du_part = 'user@' . Sys::Hostname::hostname();
+ my $domain = Sys::Hostname::hostname();
+ if (not defined $domain or $domain eq '') {
+ $domain = 'fake.dom';
+ }
+ $du_part = "user@$domain";
}
my $message_id_template = "<%s-git-send-email-%s>";
$message_id = sprintf($message_id_template, $uniq, $du_part);
--
Erik "kusma" Faye-Lund
kusmabite@gmail.com
(+47) 986 59 656
next prev parent reply other threads:[~2009-07-28 12:10 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-28 2:46 git-send-email generates mail with invalid Message-Id Frans Pop
2009-07-28 9:17 ` Erik Faye-Lund
2009-07-28 9:27 ` Thomas Rast
2009-07-28 9:51 ` Erik Faye-Lund
2009-07-28 10:03 ` Thomas Rast
2009-07-28 10:44 ` Nicolas Sebrecht
2009-07-28 11:13 ` Frans Pop
2009-07-28 11:38 ` Nicolas Sebrecht
2009-07-28 11:47 ` Erik Faye-Lund
2009-07-28 12:10 ` Erik Faye-Lund [this message]
2009-07-28 15:07 ` Nicolas Sebrecht
2009-07-28 10:14 ` Frans Pop
2009-07-28 10:26 ` Frans Pop
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=40aa078e0907280510s1afee3ddw3a9333620a3c7d7a@mail.gmail.com \
--to=kusmabite@googlemail.com \
--cc=elendil@planet.nl \
--cc=git@vger.kernel.org \
--cc=nicolas.s.dev@gmx.fr \
--cc=trast@student.ethz.ch \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).