Re: [PATCH] make git-send-email.perl handle email addresses with no names when Email::Valid is present

5 messages, 3 authors, 2016-06-15 · open the first message on its own page

Re: [PATCH] make git-send-email.perl handle email addresses with no names when Email::Valid is present

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:43:21

Greg KH [off-list ref] writes:
When using git-send-email.perl on a changeset that has:
	Cc: [off-list ref]
in the body of the description, and the Email::Valid perl module is
installed on the system, the email address will be deemed "invalid" for
some reason (Email::Valid isn't smart enough to handle this?) and
complain and not send the address the email.
That appears to be the case.

        bad foo
        bad [off-list ref]
        ok  foo@bar.baz
        ok  Foo [off-list ref]
Anyway, this tiny patch fixes this problem for me.  Note, my perl-foo is
quite week, so this could probably be easily done in one line for those
with better reg-ex skills.
quoted hunk
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -410,6 +410,9 @@ sub extract_valid_address {
 	return $address if ($address =~ /^($local_part_regexp)$/);
 
 	if ($have_email_valid) {
+		if ($address =~ s/^<//) {
+			$address =~ s/>$//;
+		}
 		return scalar Email::Valid->address($address);
 	} else {
I'd probably do:

	if ($have_email_valid) {
		$address =~ s/^<(.*)>$/$1/;
		return scalar Email::Valid->address($address);
	} else {

instead, but they are moral equivalents.

Thanks for a fix.

Re: [PATCH] make git-send-email.perl handle email addresses with no names when Email::Valid is present

From: Greg KH <hidden>
Date: 2016-06-15 22:43:21

On Thu, Jul 12, 2007 at 10:47:17PM -0700, Junio C Hamano wrote:
Greg KH [off-list ref] writes:
quoted
When using git-send-email.perl on a changeset that has:
	Cc: [off-list ref]
in the body of the description, and the Email::Valid perl module is
installed on the system, the email address will be deemed "invalid" for
some reason (Email::Valid isn't smart enough to handle this?) and
complain and not send the address the email.
That appears to be the case.

        bad foo
        bad [off-list ref]
        ok  foo@bar.baz
        ok  Foo [off-list ref]
quoted
Anyway, this tiny patch fixes this problem for me.  Note, my perl-foo is
quite week, so this could probably be easily done in one line for those
with better reg-ex skills.
quoted
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -410,6 +410,9 @@ sub extract_valid_address {
 	return $address if ($address =~ /^($local_part_regexp)$/);
 
 	if ($have_email_valid) {
+		if ($address =~ s/^<//) {
+			$address =~ s/>$//;
+		}
 		return scalar Email::Valid->address($address);
 	} else {
I'd probably do:

	if ($have_email_valid) {
		$address =~ s/^<(.*)>$/$1/;
Ah, yeah, that looks better :)

Thanks for the fix,

greg k-h

Re: [PATCH] make git-send-email.perl handle email addresses with no names when Email::Valid is present

From: Stephen Rothwell <hidden>
Date: 2016-06-15 22:43:21

On Thu, 12 Jul 2007 23:34:14 -0700 Greg KH [off-list ref] wrote:
On Thu, Jul 12, 2007 at 10:47:17PM -0700, Junio C Hamano wrote:
quoted
Greg KH [off-list ref] writes:
quoted
When using git-send-email.perl on a changeset that has:
	Cc: [off-list ref]
in the body of the description, and the Email::Valid perl module is
installed on the system, the email address will be deemed "invalid" for
some reason (Email::Valid isn't smart enough to handle this?) and
complain and not send the address the email.
That appears to be the case.

        bad foo
        bad [off-list ref]
        ok  foo@bar.baz
        ok  Foo [off-list ref]
This would be a bug in Email::Valid as it complains that the second
address fails the rfc822 check, however rfc822 says that the "display
name" before the '<' is optional.
quoted
I'd probably do:

	if ($have_email_valid) {
		$address =~ s/^<(.*)>$/$1/;
	$address =~ s/^\s*<(.*)>\s*$/$1/;

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/

Re: [PATCH] make git-send-email.perl handle email addresses with no names when Email::Valid is present

From: Greg KH <hidden>
Date: 2016-06-15 22:43:21

On Fri, Jul 13, 2007 at 06:28:18PM +1000, Stephen Rothwell wrote:
On Thu, 12 Jul 2007 23:34:14 -0700 Greg KH [off-list ref] wrote:
quoted
On Thu, Jul 12, 2007 at 10:47:17PM -0700, Junio C Hamano wrote:
quoted
Greg KH [off-list ref] writes:
quoted
When using git-send-email.perl on a changeset that has:
	Cc: [off-list ref]
in the body of the description, and the Email::Valid perl module is
installed on the system, the email address will be deemed "invalid" for
some reason (Email::Valid isn't smart enough to handle this?) and
complain and not send the address the email.
That appears to be the case.

        bad foo
        bad [off-list ref]
        ok  foo@bar.baz
        ok  Foo [off-list ref]
This would be a bug in Email::Valid as it complains that the second
address fails the rfc822 check, however rfc822 says that the "display
name" before the '<' is optional.
I agree, do you know how to get such a fix made?

thanks,

greg k-h

Re: [PATCH] make git-send-email.perl handle email addresses with no names when Email::Valid is present

From: Stephen Rothwell <hidden>
Date: 2016-06-15 22:43:21

On Fri, 13 Jul 2007 21:00:50 -0700 Greg KH [off-list ref] wrote:
On Fri, Jul 13, 2007 at 06:28:18PM +1000, Stephen Rothwell wrote:
quoted
This would be a bug in Email::Valid as it complains that the second
address fails the rfc822 check, however rfc822 says that the "display
name" before the '<' is optional.
I agree, do you know how to get such a fix made?
I would be inclined to make it my distribution's problem :-) i.e. on
Debian I would report a bug against libemail-valid-perl.

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help