git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Rast <trast@student.ethz.ch>
To: "Erik Faye-Lund" <kusmabite@googlemail.com>
Cc: Frans Pop <elendil@planet.nl>, git@vger.kernel.org
Subject: Re: git-send-email generates mail with invalid Message-Id
Date: Tue, 28 Jul 2009 11:27:43 +0200	[thread overview]
Message-ID: <200907281127.44558.trast@student.ethz.ch> (raw)
In-Reply-To: <40aa078e0907280217g76cbfai8544edde605f8772@mail.gmail.com>

Erik Faye-Lund wrote:
> On Tue, Jul 28, 2009 at 4:46 AM, Frans Pop<elendil@planet.nl> wrote:
> > I assume that this is a configuration issue in the git setup of the
> > sender, but shouldn't git-send-email refuse to send out messages with an
> > invalid Message-Id?
> 
> Not quite. git-send-email generates these message-ids itself (those
> who contain "-git-send-email-", that is), and should as such be able
> to rely on them being generated correctly. [...]
> I'm no perl-expert, but the code looks pretty much correct to me.

git-format-patch generates its own message IDs if it needs them for
threading, with gen_message_id() (in builtin-log.c).  That one appends
the committer email address blindly, without verifying that it has an
@ in it.

Blame the committer's broken config, I guess.  The untested patch at
the end might catch this, but then it's still a fair ways from correct
address verification _and_ email addresses aren't required to have a
hostname part.

diff --git i/builtin-log.c w/builtin-log.c
index fe8e4e1..7003784 100644
--- i/builtin-log.c
+++ w/builtin-log.c
@@ -604,9 +604,12 @@ static void gen_message_id(struct rev_info *info, char *base)
 	const char *committer = git_committer_info(IDENT_WARN_ON_NO_NAME);
 	const char *email_start = strrchr(committer, '<');
 	const char *email_end = strrchr(committer, '>');
+	const char *email_at = strrchr(committer, '@');
 	struct strbuf buf = STRBUF_INIT;
 	if (!email_start || !email_end || email_start > email_end - 1)
 		die("Could not extract email from committer identity.");
+	if (!email_at || email_start > email_at - 1 || email_at > email_end - 1)
+		die ("Committer email address invalid, cannot form message-id");
 	strbuf_addf(&buf, "%s.%lu.git.%.*s", base,
 		    (unsigned long) time(NULL),
 		    (int)(email_end - email_start - 1), email_start + 1);

  reply	other threads:[~2009-07-28  9:28 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 [this message]
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
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=200907281127.44558.trast@student.ethz.ch \
    --to=trast@student.ethz.ch \
    --cc=elendil@planet.nl \
    --cc=git@vger.kernel.org \
    --cc=kusmabite@googlemail.com \
    /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).