From a277d1efa35ea47ac473ed7e3d92fc6f1c04da7d Mon Sep 17 00:00:00 2001 From: Jeff King Date: Thu, 17 Mar 2016 19:58:22 -0400 Subject: [PATCH] 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 Signed-off-by: Junio C Hamano --- git-send-email.perl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/git-send-email.perl b/git-send-email.perl index d35690134..c45b22a19 100755 --- a/git-send-email.perl +++ b/git-send-email.perl @@ -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) ]; }}},