Skip to content

Commit a277d1e

Browse files
peffgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 937978e commit a277d1e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

git-send-email.perl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -533,7 +533,7 @@ sub parse_sendmail_aliases {
533533
$aliases{$alias} = \@addr
534534
}}},
535535
mailrc => sub { my $fh = shift; while (<$fh>) {
536-
if (/^alias\s+(\S+)\s+(.*)$/) {
536+
if (/^alias\s+(\S+)\s+(.*?)\s*$/) {
537537
# spaces delimit multiple addresses
538538
$aliases{$1} = [ quotewords('\s+', 0, $2) ];
539539
}}},

0 commit comments

Comments
 (0)