All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Wong <normalperson@yhbt.net>
To: "Horst H. von Brand" <vonbrand@inf.utfsm.cl>
Cc: git@vger.kernel.org, Junio C Hamano <junkio@cox.net>,
	Ryan Anderson <ryan@michonline.com>
Subject: Re: [PATCH] Cleanup git-send-email.perl:extract_valid_email
Date: Sat, 3 Jun 2006 15:49:36 -0700	[thread overview]
Message-ID: <20060603224935.GA10324@hand.yhbt.net> (raw)
In-Reply-To: <11493547080-git-send-email-vonbrand@inf.utfsm.cl>

"Horst H. von Brand" <vonbrand@inf.utfsm.cl> wrote:
> - Fix the regular expressions for local addresses
> - Fix the fallback regexp for non-local addresses, simplify the logic
> 
> Signed-off-by: Horst H. von Brand <vonbrand@inf.utfsm.cl>
> ---
>  git-send-email.perl |    9 +++------
>  1 files changed, 3 insertions(+), 6 deletions(-)
> 
> diff --git a/git-send-email.perl b/git-send-email.perl
> index ed1d89b..a7a7797 100755
> --- a/git-send-email.perl
> +++ b/git-send-email.perl
> @@ -314,18 +314,15 @@ sub extract_valid_address {
>  	my $address = shift;
>  
>  	# check for a local address:
> -	return $address if ($address =~ /^([\w\-]+)$/);
> +	return $address if ($address =~ /^([\w\-.]+)$/);

I keep forgetting this, '+' is a valid (and useful) setup, too.

>  
>  	if ($have_email_valid) {
>  		return Email::Valid->address($address);
>  	} else {
>  		# less robust/correct than the monster regexp in Email::Valid,
>  		# but still does a 99% job, and one less dependency
> -		my $cleaned_address;
> -		if ($address =~ /([^\"<>\s]+@[^<>\s]+)/) {
> -			$cleaned_address = $1;
> -		}
> -		return $cleaned_address;
> +		$address =~ /([\w\-.]+@[\w\-.]+)/;
> +		return $1;

Actually, I'm retracting my earlier ack on this.  This is way too
restrictive.  I'd rather allow an occasional invalid email address than
to reject valid ones.  I generally trust git users to know what they're
doing when entering email addresses[1].

*, $, ^, +, = are all valid characters in the username portion (not sure
about local accounts, though), and I'm sure there are more that I don't
know about.

[1] - of course, without address book support in git-send-email, I think
I would've left the 'k' out of Junio's email address by now.  Of course
there's also the issue of where I work and having several people using
variations of rob/robert in their email address.  I'm likely to make
errors like these far more than entering addresses that email systems
consider invalid, and I suspect I'm not the only one.

-- 
Eric Wong

  reply	other threads:[~2006-06-03 22:49 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-06-03 17:11 [PATCH] Cleanup git-send-email.perl:extract_valid_email Horst H. von Brand
2006-06-03 22:49 ` Eric Wong [this message]
2006-06-04  0:10   ` Horst von Brand
2006-06-06  6:59     ` Junio C Hamano
2006-06-06 15:42       ` Horst von Brand
2006-06-06 15:54         ` Junio C Hamano
2006-06-06 16:05           ` Horst von Brand
2006-06-06 16:58             ` Junio C Hamano
2006-06-06 21:24               ` Horst von Brand
2006-06-06 21:39                 ` Junio C Hamano
2006-06-06 22:48                   ` Horst von Brand

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=20060603224935.GA10324@hand.yhbt.net \
    --to=normalperson@yhbt.net \
    --cc=git@vger.kernel.org \
    --cc=junkio@cox.net \
    --cc=ryan@michonline.com \
    --cc=vonbrand@inf.utfsm.cl \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.