Re: [RFC 0/1] mailinfo: de-quote quoted-pair in header fields

2 messages, 2 authors, 2016-09-14 · open the first message on its own page

Re: [RFC 0/1] mailinfo: de-quote quoted-pair in header fields

From: Junio C Hamano <hidden>
Date: 2016-09-14 05:55:01

Jeff King [off-list ref] writes:
It has been a while since I looked at rfc2822, but aren't the quoting
and syntax rules different for addresses versus other headers? We would
not want to dequote a Subject header, I think.
You're absolutely right.  RFC2822 does not quite _want_ to dequote
anything.  As you pointed out in a separate message, we are the one
who want to strip out "" quoting when mailinfo says

	Author: "Jeff King"

to its standard output (aka "info"), and turn it into

	GIT_AUTHOR_NAME='Jeff King'

and do so ONLY for the author name.

So I would think it is the responsibility of the one that reads the
"info" file that is produced by mailinfo to dequote the backslash
thing if the mailinfo gave us

	Author: "Jeff \"Peff\" King"

Re: [RFC 0/1] mailinfo: de-quote quoted-pair in header fields

From: Kevin Daudt <hidden>
Date: 2016-09-14 16:03:25

On Tue, Sep 13, 2016 at 10:54:47PM -0700, Junio C Hamano wrote:
Jeff King [off-list ref] writes:
quoted
It has been a while since I looked at rfc2822, but aren't the quoting
and syntax rules different for addresses versus other headers? We would
not want to dequote a Subject header, I think.
You're absolutely right.  RFC2822 does not quite _want_ to dequote
anything.  As you pointed out in a separate message, we are the one
who want to strip out "" quoting when mailinfo says

	Author: "Jeff King"

to its standard output (aka "info"), and turn it into

	GIT_AUTHOR_NAME='Jeff King'

and do so ONLY for the author name.

So I would think it is the responsibility of the one that reads the
"info" file that is produced by mailinfo to dequote the backslash
thing if the mailinfo gave us

	Author: "Jeff \"Peff\" King"
The RFC makes a distinction between structured fields and unstructured
fields. Quoting would not even be necessary for unstructured fields
(like Subject), so yes, that those fields should be left alone.

Unstructures fields are subject, comments, keywords and optional fields,
the rest is considered structured.

Because the only field where this is a problem is the From field, I
think it would be safe to limit the unquoting just to that field.

My reasoning to do the unquoting here is because it's the RFC requires
the quoting in the first place.

I already noticed a bug in the current unquoting of the author when
adding a comment to the From: field.

    From: "A U Thor" [off-list ref] (test)

When applied the the author of this patch shows up as:

    Author: A U Thor" (test) [off-list ref]

So I agree with Jeff[1] where he states that the surrounding quotes
should be removed, if that's not a problem for git.

[1]:https://public-inbox.org/git/20160914051305.vphknpsikyxi3hg3@sigill.intra.peff.net/
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help