git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC 0/1] de-quote quoted-strings in mailinfo
@ 2016-09-13 23:42 Kevin Daudt
  0 siblings, 0 replies; 2+ messages in thread
From: Kevin Daudt @ 2016-09-13 23:42 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano, Kevin Daudt

This is my first 'big' C patch, so first an RFC. 

This patch implements RFC2822 dequoting of quoted-pairs in quoted
strings, which was not done yet. This means removing the "\" as escape
character from header fields, but only quoted strings, and comments
(text between braces).

According to the RFC, comments can also appear in square brackets in the
e-mail domain, but that has not been implemented. In fact, just like
other functions, it just looks at the whole header line.

Please let me know what you think.

Kevin Daudt (1):
  mailinfo: de-quote quoted-pair in header fields

 mailinfo.c                 | 46 ++++++++++++++++++++++++++++++++++++++++++++++
 t/t5100-mailinfo.sh        |  5 +++++
 t/t5100/quoted-pair.expect |  5 +++++
 t/t5100/quoted-pair.in     |  9 +++++++++
 t/t5100/quoted-pair.info   |  5 +++++
 5 files changed, 70 insertions(+)
 create mode 100644 t/t5100/quoted-pair.expect
 create mode 100644 t/t5100/quoted-pair.in
 create mode 100644 t/t5100/quoted-pair.info

-- 
2.10.0.rc2


^ permalink raw reply	[flat|nested] 2+ messages in thread
* Re: git-am includes escape characters from 'From' field
@ 2016-09-13 15:26 Jeff King
  2016-09-13 23:46 ` [RFC 0/1] de-quote quoted-strings in mailinfo Kevin Daudt
  0 siblings, 1 reply; 2+ messages in thread
From: Jeff King @ 2016-09-13 15:26 UTC (permalink / raw)
  To: Swift Geek; +Cc: git

On Mon, Sep 12, 2016 at 10:10:23PM +0200, Swift Geek wrote:

> git-am seems to add backslash that escapes double quote character, example
> git format-patch
> 
> From 63da989a5295214f9bd06cd7b409a86a65241eea Mon Sep 17 00:00:00 2001
> From: "Sebastian \"Swift Geek\" Grzywna" <swiftgeek@gmail.com>

This looks correct; the output of format-patch is an rfc2822 message,
and it requires this quoting.

The part you don't show, and that I think is wrong, is that if you then
"git am" this patch, it pulls the backslashes into the commit object.
The culprit looks like "parse_mail()" in builtin/am.c (or possibly
mailinfo() that it calls), which blindly picks up the name portion
without doing any rfc2822 de-quoting.

I don't think we have any existing de-quoting routines to plug in, so
fixing it would probably start with writing one.

-Peff

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-09-13 23:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-09-13 23:42 [RFC 0/1] de-quote quoted-strings in mailinfo Kevin Daudt
  -- strict thread matches above, loose matches on Subject: below --
2016-09-13 15:26 git-am includes escape characters from 'From' field Jeff King
2016-09-13 23:46 ` [RFC 0/1] de-quote quoted-strings in mailinfo Kevin Daudt

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).