1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-05-05 21:06:11 +02:00

send-email: ignore trailing whitespace in mailrc alias file

The regex for parsing mailrc considers everything after the
second whitespace to be the email address, up to the end of
the line. We have to include whitespace there, because you
may have multiple space-separated addresses, each with their
own internal quoting.

But if there is trailing whitespace, we include that, too.
This confuses quotewords() when we try to split the
individual addresses, and we end up storing "undef" in our
alias list. Later parts of the code then access that,
generating perl warnings.

Let's tweak our regex to throw away any trailing whitespace
on each line.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Jeff King 2016-03-17 19:58:22 -04:00 committed by Junio C Hamano
parent 937978e0f3
commit a277d1efa3

View File

@ -533,7 +533,7 @@ sub parse_sendmail_aliases {
$aliases{$alias} = \@addr
}}},
mailrc => sub { my $fh = shift; while (<$fh>) {
if (/^alias\s+(\S+)\s+(.*)$/) {
if (/^alias\s+(\S+)\s+(.*?)\s*$/) {
# spaces delimit multiple addresses
$aliases{$1} = [ quotewords('\s+', 0, $2) ];
}}},