* One whitespace breaks sending mail (using mailrc aliases wit send-emal) @ 2016-03-17 1:28 Stefan Beller 2016-03-17 2:00 ` Jeff King 0 siblings, 1 reply; 4+ messages in thread From: Stefan Beller @ 2016-03-17 1:28 UTC (permalink / raw) To: git@vger.kernel.org To reproduce: $ git config sendemail.aliasesfile ~/.mailrc $ git config sendemail.aliasfiletype mailrc $ echo "alias zzz_wrong_entry jon@do.e " # notice the white space at the end of the alias $ git send-email 0001-rebase-x-do-not-die-without-i.patch --cc=zzz_wrong_entry Use of uninitialized value $alias in hash element at /usr/local/google/home/sbeller/libexec/git-core/git-send-email line 847. Use of uninitialized value $alias in hash element at /usr/local/google/home/sbeller/libexec/git-core/git-send-email line 850. Use of uninitialized value $alias in hash element at /usr/local/google/home/sbeller/libexec/git-core/git-send-email line 850. Use of uninitialized value $alias in hash element at /usr/local/google/home/sbeller/libexec/git-core/git-send-email line 850. Use of uninitialized value $alias in hash element at /usr/local/google/home/sbeller/libexec/git-core/git-send-email line 851. Use of uninitialized value $recipient in substitution (s///) at /usr/local/google/home/sbeller/libexec/git-core/git-send-email line 1036. Use of uninitialized value $recipient in pattern match (m//) at /usr/local/google/home/sbeller/libexec/git-core/git-send-email line 1038. Use of uninitialized value $address in pattern match (m//) at /usr/local/google/home/sbeller/libexec/git-core/git-send-email line 894. Use of uninitialized value $address in substitution (s///) at /usr/local/google/home/sbeller/libexec/git-core/git-send-email line 896. Use of uninitialized value $params[0] in pattern match (m//) at /usr/share/perl5/Email/Valid.pm line 79. Use of uninitialized value $address in concatenation (.) or string at /usr/local/google/home/sbeller/libexec/git-core/git-send-email line 918. error: unable to extract a valid address from: What to do with this address? ([q]uit|[d]rop|[e]dit): The stack trace doesn't even show the wrong address, so debugging that was hard. Not sure I am asking for help, as I found the problem and could fix it, but maybe we can improve the error message (I have no knowledge about perl, so I may not be super helpful there) Thanks, Stefan ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: One whitespace breaks sending mail (using mailrc aliases wit send-emal) 2016-03-17 1:28 One whitespace breaks sending mail (using mailrc aliases wit send-emal) Stefan Beller @ 2016-03-17 2:00 ` Jeff King 2016-03-17 17:47 ` [PATCH] That works Stefan Beller 0 siblings, 1 reply; 4+ messages in thread From: Jeff King @ 2016-03-17 2:00 UTC (permalink / raw) To: Stefan Beller; +Cc: git@vger.kernel.org On Wed, Mar 16, 2016 at 06:28:59PM -0700, Stefan Beller wrote: > To reproduce: > > $ git config sendemail.aliasesfile ~/.mailrc > $ git config sendemail.aliasfiletype mailrc > $ echo "alias zzz_wrong_entry jon@do.e " > # notice the white space at the end of the alias > > $ git send-email 0001-rebase-x-do-not-die-without-i.patch --cc=zzz_wrong_entry > Use of uninitialized value $alias in hash element at > /usr/local/google/home/sbeller/libexec/git-core/git-send-email line > 847. > [...] > The stack trace doesn't even show the wrong address, so debugging that was hard. > Not sure I am asking for help, as I found the problem and could fix > it, but maybe we can > improve the error message (I have no knowledge about perl, so I may > not be super helpful there) I don't think so. The problem is that we return `undef` for one of the aliases, and then later when we look at that, perl obviously is unhappy. It's sort of the equivalent of a C program dereferencing NULL, but the bug is assigning NULL in the first place much earlier. You _can_ tell perl not to bother warning about accessing undef like this, but it's usually a good idea to have such warnings on, as they are helpful for finding real bugs. I imagine your problem is by: diff --git a/git-send-email.perl b/git-send-email.perl index d356901..c45b22a 100755 --- a/git-send-email.perl +++ b/git-send-email.perl @@ -533,7 +533,7 @@ my %parse_alias = ( $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) ]; }}}, to suppress the extra whitespace at the end (alternatively, there may be a way to tell quotewords() to throw out a trailing delimiter, but I don't know the Text::ParseWords module well enough to say offhand). -Peff ^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH] That works 2016-03-17 2:00 ` Jeff King @ 2016-03-17 17:47 ` Stefan Beller 2016-03-17 18:00 ` Jeff King 0 siblings, 1 reply; 4+ messages in thread From: Stefan Beller @ 2016-03-17 17:47 UTC (permalink / raw) To: peff; +Cc: git, Stefan Beller sent from git-send-email with a corrupt .mailrc file. Thanks, Stefan diff --git a/git-send-email.perl b/git-send-email.perl index d356901..c45b22a 100755 --- a/git-send-email.perl +++ b/git-send-email.perl @@ -533,7 +533,7 @@ my %parse_alias = ( $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) ]; }}}, ^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] That works 2016-03-17 17:47 ` [PATCH] That works Stefan Beller @ 2016-03-17 18:00 ` Jeff King 0 siblings, 0 replies; 4+ messages in thread From: Jeff King @ 2016-03-17 18:00 UTC (permalink / raw) To: Stefan Beller; +Cc: git On Thu, Mar 17, 2016 at 10:47:50AM -0700, Stefan Beller wrote: > sent from git-send-email with a corrupt .mailrc file. Great, but could probably use a better commit message. ;P -Peff ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-03-17 18:01 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2016-03-17 1:28 One whitespace breaks sending mail (using mailrc aliases wit send-emal) Stefan Beller 2016-03-17 2:00 ` Jeff King 2016-03-17 17:47 ` [PATCH] That works Stefan Beller 2016-03-17 18:00 ` Jeff King
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 NNTP newsgroup(s).