git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: git-send-email generates mail with invalid Message-Id

From
Thomas Rast <trast@student.ethz.ch>
Date
Jul 28, 2009, 09:27 UTC
Message-ID
<200907281127.44558.trast@student.ethz.ch>
In-Reply-To
<40aa078e0907280217g76cbfai8544edde605f8772@mail.gmail.com>
Erik Faye-Lund wrote:
Show 9 quoted lines
> 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);
Previous: Erik Faye-LundNext: Erik Faye-Lund
Message 3 of 13 in “git-send-email generates mail with invalid Message-Id”
  1. Frans PopJul 28, 2009
  2. Erik Faye-LundJul 28, 2009
  3. Thomas RastJul 28, 2009
  4. Erik Faye-LundJul 28, 2009
  5. Thomas RastJul 28, 2009
  6. Frans PopJul 28, 2009
  7. Frans PopJul 28, 2009
  8. Nicolas SebrechtJul 28, 2009
  9. Frans PopJul 28, 2009
  10. Nicolas SebrechtJul 28, 2009
  11. Erik Faye-LundJul 28, 2009
  12. Erik Faye-LundJul 28, 2009
  13. Nicolas SebrechtJul 28, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.