From: Krzysztof Mazur <krzysiek@podlesie.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] git-send-email: don't return undefined value in extract_valid_address()
Date: Tue, 20 Nov 2012 21:47:36 +0100 [thread overview]
Message-ID: <20121120204736.GA7039@shrek.podlesie.net> (raw)
In-Reply-To: <7v8v9wrpdz.fsf@alter.siamese.dyndns.org>
On Tue, Nov 20, 2012 at 12:27:36PM -0800, Junio C Hamano wrote:
> Krzysztof Mazur <krzysiek@podlesie.net> writes:
>
> > In the fallback check, when Email::Valid is not available, the
> > extract_valid_address() does not check for success of matching regex,
> > and $1, which can be undefined, is always returned. Now if match
> > fails an empty string is returned.
Maybe the last line of comment should be changed to:
fails an empty string is returned to indicate failure.
>
> That much we can read from the code, but a bigger question is why
> would it be a good thing for the callers? Wouldn't they want to
> be able to distinguish a failure from an empty string?
In this case returning empty string does not make sense, so it's
really used to indicate failure.
>
> > Signed-off-by: Krzysztof Mazur <krzysiek@podlesie.net>
> > ---
> > This fixes following warnings:
> > Use of uninitialized value in string eq at ./git-send-email.perl line 1017.
> > Use of uninitialized value in quotemeta at ./git-send-email.perl line 1017.
> > W: unable to extract a valid address from: x a.patch
> >
> > when invalid email address was added by --cc-cmd,
> > ./git-send-email.perl --dry-run --to a@podlesie.net --cc-cmd=echo x a.patch
>
> In other words, would we want to *hide* (not "fix") the warning?
> Shouldn't we be barfing loudly and possibly erroring it out until
> the user fixes her --cc-cmd?
>
Yes, it's just to hide the warning, the error (warning in this case) it's
already correctly generated:
W: unable to extract a valid address from: x a.patch
Maybe we should change it to an error?
Krzysiek
next prev parent reply other threads:[~2012-11-20 20:47 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-20 12:20 [PATCH] git-send-email: don't return undefined value in extract_valid_address() Krzysztof Mazur
2012-11-20 20:27 ` Junio C Hamano
2012-11-20 20:47 ` Krzysztof Mazur [this message]
2012-11-20 22:14 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20121120204736.GA7039@shrek.podlesie.net \
--to=krzysiek@podlesie.net \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox