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

Re: bug (?) in send email

From
Thomas Rast <trast@student.ethz.ch>
Date
Jul 30, 2012, 12:30 UTC
Message-ID
<873949mnx0.fsf@thomas.inf.ethz.ch>
In-Reply-To
<50166408.8000008@web.de>
[+Cc people involved with this function]
Christoph Miebach <christoph.miebach@web.de> writes:
Show 21 quoted lines
> > git commit --author="Michał Tz <name_1911@some.com>" modified.file -m
> > "Test"
> >
> > git format-patch -o patches origin
> >
> > Now, the patch seems to have the address right, see [1]
> >
> > git send-email  --to MYOWN.ADDRESS@mail.com --suppress-cc=author
> > patches/0001-Test.patch
> >
> > But checking my inbox now shows an email starting with:
> > From: Michał Tz <name 1911@some.com>
> 
> Removing this line
> s/_/ /g;
> here
> https://github.com/git/git/blob/master/git-send-email.perl#L867
>
> Solves this problem for me. But I really don't have any clue, what
> kind of side effects this modification on "sub unquote_rfc2047" might
> have.

It would prevent spaces from being decoded correctly if the encoding program chooses to make the '_'. git-format-patch does not actually do this, see the big comment around pretty.c:304.

I think this patch would be a better match for what RFC2047 specifies. On the one hand it avoids substituting _ outside of encodings, but OTOH it also handles more than one encoded-word. It still does not handle the case where there are several encoded-words of *different* encodings, but who would do such a crazy thing?

diff --git i/git-send-email.perl w/git-send-email.perl
index ef30c55..88c4758 100755
--- i/git-send-email.perl
+++ w/git-send-email.perl
@@ -862,11 +862,13 @@ sub make_message_id {
 sub unquote_rfc2047 {
 	local ($_) = @_;
 	my $encoding;
-	if (s/=\?([^?]+)\?q\?(.*)\?=/$2/g) {
+	s{=\?([^?]+)\?q\?(.*)\?=}{
 		$encoding = $1;
-		s/_/ /g;
-		s/=([0-9A-F]{2})/chr(hex($1))/eg;
-	}
+		my $e = $2;
+		$e =~ s/_/ /g;
+		$e =~ s/=([0-9A-F]{2})/chr(hex($1))/eg;
+		$e;
+	}eg;
 	return wantarray ? ($_, $encoding) : $_;
 }
 
-- 
Thomas Rast
trast@{inf,student}.ethz.ch
Previous: Christoph MiebachNext: Junio C Hamano
Message 3 of 6 in “bug (?) in send email”
  1. Christoph MiebachJul 28, 2012
  2. Christoph MiebachJul 30, 2012
  3. Thomas RastJul 30, 2012
  4. Junio C HamanoJul 30, 2012
  5. Jeff KingJul 30, 2012
  6. Jeff KingJul 30, 2012

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.