* [BUG] git send-email: incorrectly parses email address with comma
@ 2018-05-12 8:21 Heinrich Schuchardt
2018-05-12 9:48 ` Jeff King
0 siblings, 1 reply; 3+ messages in thread
From: Heinrich Schuchardt @ 2018-05-12 8:21 UTC (permalink / raw)
To: git
Git send-email allows to combine multiple email addresses in one
parameter, e.g.
--to="a@example.com, b@example.com"
But email addresses may contain commas themselves:
--to="LASTNAME, firstname <firstname.lastname@example.com>"
This may lead to an error:
$ git send-email --to="Schuchardt, Heinrich <xypron.glpk@example.com>" \
0000*.patch0000-cover-letter.patch
(mbox) Adding cc: Heinrich Schuchardt <xypron.glpk@example.com> from
line 'From: Heinrich Schuchardt <xypron.glpk@example.com>'
From: Heinrich Schuchardt <xypron.glpk@example.com>
To: Schuchardt,
Heinrich <xypron.glpk@example.com>
Subject: [PATCH 0/2] efi_loader: adjust definitions of variable services
Date: Sat, 12 May 2018 10:01:21 +0200
Message-Id: <20180512080121.26620-1-xypron.glpk@example.com>
X-Mailer: git-send-email 2.17.0
Send this email? ([y]es|[n]o|[q]uit|[a]ll): a
Password for 'smtp://xypron.glpk@example.com@mail.example.com:587':
Syntax error in parameters or arguments
Please, implement the following logic,
If the string preceding a comma is not a valid email address do not
split it off.
Best regards
Heinrich Schuchardt
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [BUG] git send-email: incorrectly parses email address with comma
2018-05-12 8:21 [BUG] git send-email: incorrectly parses email address with comma Heinrich Schuchardt
@ 2018-05-12 9:48 ` Jeff King
2018-05-12 21:07 ` Heinrich Schuchardt
0 siblings, 1 reply; 3+ messages in thread
From: Jeff King @ 2018-05-12 9:48 UTC (permalink / raw)
To: Heinrich Schuchardt; +Cc: git
On Sat, May 12, 2018 at 10:21:46AM +0200, Heinrich Schuchardt wrote:
> Git send-email allows to combine multiple email addresses in one
> parameter, e.g.
>
> --to="a@example.com, b@example.com"
>
> But email addresses may contain commas themselves:
>
> --to="LASTNAME, firstname <firstname.lastname@example.com>"
>
> This may lead to an error:
If the name contains syntactically relevant metacharacters, it can be
quoted. So as a workaround, you can do:
--to='"LASTNAME, firstname" <firstname.lastname@example.com>'
I think rfc822 actually requires even names with just spaces in them to
be quoted, but git-send-email and most other mail programs are pretty
lax about allowing just about anything outside of the <>, so people tend
not to bother.
> If the string preceding a comma is not a valid email address do not
> split it off.
That might work as a heuristic, though "is a valid email address" is a
notoriously hard thing to check. Possibly looking for an "@" would catch
most common cases, though.
-Peff
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [BUG] git send-email: incorrectly parses email address with comma
2018-05-12 9:48 ` Jeff King
@ 2018-05-12 21:07 ` Heinrich Schuchardt
0 siblings, 0 replies; 3+ messages in thread
From: Heinrich Schuchardt @ 2018-05-12 21:07 UTC (permalink / raw)
To: Jeff King; +Cc: git
On 05/12/2018 11:48 AM, Jeff King wrote:
> On Sat, May 12, 2018 at 10:21:46AM +0200, Heinrich Schuchardt wrote:
>
>> Git send-email allows to combine multiple email addresses in one
>> parameter, e.g.
>>
>> --to="a@example.com, b@example.com"
>>
>> But email addresses may contain commas themselves:
>>
>> --to="LASTNAME, firstname <firstname.lastname@example.com>"
>>
>> This may lead to an error:
>
> If the name contains syntactically relevant metacharacters, it can be
> quoted. So as a workaround, you can do:
>
> --to='"LASTNAME, firstname" <firstname.lastname@example.com>'
>
> I think rfc822 actually requires even names with just spaces in them to
> be quoted, but git-send-email and most other mail programs are pretty
> lax about allowing just about anything outside of the <>, so people tend
> not to bother.
>
>> If the string preceding a comma is not a valid email address do not
>> split it off.
>
> That might work as a heuristic, though "is a valid email address" is a
> notoriously hard thing to check. Possibly looking for an "@" would catch
> most common cases, though.
A more elaborate test would be:
A string matching [\S\s]*<\S+@\S+.\S+>\s* is an email address.
A string matching \s*\S+@\S+.\S+\s* is an email address.
Both may need trimming of whitespace.
Any other string is not an email address.
Regards
Heinrich
>
> -Peff
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-05-12 21:10 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-12 8:21 [BUG] git send-email: incorrectly parses email address with comma Heinrich Schuchardt
2018-05-12 9:48 ` Jeff King
2018-05-12 21:07 ` Heinrich Schuchardt
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
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 read-only IMAP folder(s) and NNTP newsgroup(s).