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

Re: send-email garbled header with trailing doublequote in email

From
Jeff King <peff@peff.net>
Date
Nov 3, 2016, 14:18 UTC
Message-ID
<20161103141848.42pg6iow24prign5@sigill.intra.peff.net>
In-Reply-To
<20161102222901.GK4611@redhat.com>
On Wed, Nov 02, 2016 at 11:29:01PM +0100, Andrea Arcangeli wrote:
Show 7 quoted lines
> So this must be postfix then that out of the blue decided to garble it
> in a strange way while parsing the input... The removal of all
> whitespaces s/what ever/whatever/ especially I've no idea how it
> decided to do so.
> 
> Can you reproduce with postfix as sendmail at least? If you can
> reproduce also see what happens if you add another --to.

Yes, I can easily reproduce without using git at all by installing postfix in local-delivery mode and running:

sendmail peff@sigill.intra.peff.net <<\EOF
From: Jeff King <peff@peff.net>
To: "what ever" " <peff@sigill.intra.peff.net>
Subject: patch

This is the body EOF

Many MTAs do this kind of header-rewriting. I don't necessarily agree with it as a general concept, but the real problem is the syntactically bogus header. The munging that postfix does makes things worse, but I can see why it is confused and does what it does (the whole email is inside a double-quoted portion that is never closed, so it probably thinks there is no hostname portion at all).

So git is possibly at fault for passing along a bogus address. OTOH, the user is perhaps at fault for providing the bogus address to git in the first place. GIGO. :)

I think if any change were to be made, it would be to recognize this bogosity and either clean it up or abort. That ideally would happen via Mail::Address so git does not have to add a bunch of ad-hoc "is this valid rfc822" checks. Reading the manpage for that module, though, it says:

  [we do not handle all of rfc2822]
  Often requests are made to the maintainers of this code improve this
  situation, but this is not a good idea, where it will break zillions
  of existing applications.  If you wish for a fully RFC2822 compliant
  implementation you may take a look at Mail::Message::Field::Full, part
  of MailBox.

So it's possible that switching to a more robust module would improve things.

-Peff
Previous: Andrea ArcangeliNext: demerphq
Message 6 of 9 in “send-email garbled header with trailing doublequote in email”
  1. Andrea ArcangeliNov 2, 2016
  2. Jeff KingNov 2, 2016
  3. Andrea ArcangeliNov 2, 2016
  4. Jeff KingNov 2, 2016
  5. Andrea ArcangeliNov 2, 2016
  6. Jeff KingNov 3, 2016
  7. demerphqNov 3, 2016
  8. Andrea ArcangeliNov 4, 2016
  9. Jeff KingNov 4, 2016

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.