{"thread":{"id":"9016","subject":"[PATCH] make git-send-email.perl handle email addresses with no names when Email::Valid is present","startedAt":"2007-07-13T04:17:49Z","lastAt":"2007-08-09T12:28:59Z","messageCount":7,"participants":["Greg KH","Junio C Hamano","Stephen Rothwell","Uwe Kleine-König"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"47230","messageId":"20070713041749.GA28824@kroah.com","threadId":"9016","inReplyTo":null,"subject":"[PATCH] make git-send-email.perl handle email addresses with no names when Email::Valid is present","fromName":"Greg KH","fromEmail":"greg@kroah.com","sentAt":"2007-07-13T04:17:49Z","receivedAt":"2007-07-13T04:17:49Z","isPatch":true,"sender":{"key":"greg@kroah.com","avatar":"https://gravatar.com/avatar/5bb5aa0cc2e01c00ec899d11130c07796bc186e465bae57bc34873b13b72c7c8?d=mp&s=160"},"body":"When using git-send-email.perl on a changeset that has:\n\tCc: <stable@kernel.org>\nin the body of the description, and the Email::Valid perl module is\ninstalled on the system, the email address will be deemed \"invalid\" for\nsome reason (Email::Valid isn't smart enough to handle this?) and\ncomplain and not send the address the email.\n\nAnyway, this tiny patch fixes this problem for me.  Note, my perl-foo is\nquite week, so this could probably be easily done in one line for those\nwith better reg-ex skills.\n\n\nSigned-off-by: Greg Kroah-Hartman <gregkh@suse.de>\n\n--- a/git-send-email.perl\n+++ b/git-send-email.perl\n@@ -410,6 +410,9 @@ sub extract_valid_address {\n \treturn $address if ($address =~ /^($local_part_regexp)$/);\n \n \tif ($have_email_valid) {\n+\t\tif ($address =~ s/^<//) {\n+\t\t\t$address =~ s/>$//;\n+\t\t}\n \t\treturn scalar Email::Valid->address($address);\n \t} else {\n \t\t# less robust/correct than the monster regexp in Email::Valid,\n"},{"id":"47233","messageId":"7vr6ncrh22.fsf@assigned-by-dhcp.cox.net","threadId":"9016","inReplyTo":"20070713041749.GA28824@kroah.com","subject":"Re: [PATCH] make git-send-email.perl handle email addresses with no names when Email::Valid is present","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2007-07-13T05:47:17Z","receivedAt":"2007-07-13T05:47:17Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Greg KH <greg@kroah.com> writes:\n\n> When using git-send-email.perl on a changeset that has:\n> \tCc: <stable@kernel.org>\n> in the body of the description, and the Email::Valid perl module is\n> installed on the system, the email address will be deemed \"invalid\" for\n> some reason (Email::Valid isn't smart enough to handle this?) and\n> complain and not send the address the email.\n\nThat appears to be the case.\n\n        bad foo\n        bad <foo@bar.baz>\n        ok  foo@bar.baz\n        ok  Foo <foo@bar.baz>\n\n> Anyway, this tiny patch fixes this problem for me.  Note, my perl-foo is\n> quite week, so this could probably be easily done in one line for those\n> with better reg-ex skills.\n\n> --- a/git-send-email.perl\n> +++ b/git-send-email.perl\n> @@ -410,6 +410,9 @@ sub extract_valid_address {\n>  \treturn $address if ($address =~ /^($local_part_regexp)$/);\n>  \n>  \tif ($have_email_valid) {\n> +\t\tif ($address =~ s/^<//) {\n> +\t\t\t$address =~ s/>$//;\n> +\t\t}\n>  \t\treturn scalar Email::Valid->address($address);\n>  \t} else {\n\nI'd probably do:\n\n\tif ($have_email_valid) {\n\t\t$address =~ s/^<(.*)>$/$1/;\n\t\treturn scalar Email::Valid->address($address);\n\t} else {\n\ninstead, but they are moral equivalents.\n\nThanks for a fix.\n"},{"id":"47237","messageId":"20070713063414.GN24317@kroah.com","threadId":"9016","inReplyTo":"7vr6ncrh22.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH] make git-send-email.perl handle email addresses with no names when Email::Valid is present","fromName":"Greg KH","fromEmail":"greg@kroah.com","sentAt":"2007-07-13T06:34:14Z","receivedAt":"2007-07-13T06:34:14Z","isPatch":true,"sender":{"key":"greg@kroah.com","avatar":"https://gravatar.com/avatar/5bb5aa0cc2e01c00ec899d11130c07796bc186e465bae57bc34873b13b72c7c8?d=mp&s=160"},"body":"On Thu, Jul 12, 2007 at 10:47:17PM -0700, Junio C Hamano wrote:\n> Greg KH <greg@kroah.com> writes:\n> \n> > When using git-send-email.perl on a changeset that has:\n> > \tCc: <stable@kernel.org>\n> > in the body of the description, and the Email::Valid perl module is\n> > installed on the system, the email address will be deemed \"invalid\" for\n> > some reason (Email::Valid isn't smart enough to handle this?) and\n> > complain and not send the address the email.\n> \n> That appears to be the case.\n> \n>         bad foo\n>         bad <foo@bar.baz>\n>         ok  foo@bar.baz\n>         ok  Foo <foo@bar.baz>\n> \n> > Anyway, this tiny patch fixes this problem for me.  Note, my perl-foo is\n> > quite week, so this could probably be easily done in one line for those\n> > with better reg-ex skills.\n> \n> > --- a/git-send-email.perl\n> > +++ b/git-send-email.perl\n> > @@ -410,6 +410,9 @@ sub extract_valid_address {\n> >  \treturn $address if ($address =~ /^($local_part_regexp)$/);\n> >  \n> >  \tif ($have_email_valid) {\n> > +\t\tif ($address =~ s/^<//) {\n> > +\t\t\t$address =~ s/>$//;\n> > +\t\t}\n> >  \t\treturn scalar Email::Valid->address($address);\n> >  \t} else {\n> \n> I'd probably do:\n> \n> \tif ($have_email_valid) {\n> \t\t$address =~ s/^<(.*)>$/$1/;\n\nAh, yeah, that looks better :)\n\nThanks for the fix,\n\ngreg k-h\n"},{"id":"47244","messageId":"20070713182818.fd37372f.sfr@canb.auug.org.au","threadId":"9016","inReplyTo":"20070713063414.GN24317@kroah.com","subject":"Re: [PATCH] make git-send-email.perl handle email addresses with no names when Email::Valid is present","fromName":"Stephen Rothwell","fromEmail":"sfr@canb.auug.org.au","sentAt":"2007-07-13T08:28:18Z","receivedAt":"2007-07-13T08:28:18Z","isPatch":true,"sender":{"key":"sfr@canb.auug.org.au","avatar":null},"body":"On Thu, 12 Jul 2007 23:34:14 -0700 Greg KH <greg@kroah.com> wrote:\n>\n> On Thu, Jul 12, 2007 at 10:47:17PM -0700, Junio C Hamano wrote:\n> > Greg KH <greg@kroah.com> writes:\n> > \n> > > When using git-send-email.perl on a changeset that has:\n> > > \tCc: <stable@kernel.org>\n> > > in the body of the description, and the Email::Valid perl module is\n> > > installed on the system, the email address will be deemed \"invalid\" for\n> > > some reason (Email::Valid isn't smart enough to handle this?) and\n> > > complain and not send the address the email.\n> > \n> > That appears to be the case.\n> > \n> >         bad foo\n> >         bad <foo@bar.baz>\n> >         ok  foo@bar.baz\n> >         ok  Foo <foo@bar.baz>\n\nThis would be a bug in Email::Valid as it complains that the second\naddress fails the rfc822 check, however rfc822 says that the \"display\nname\" before the '<' is optional.\n\n> > I'd probably do:\n> > \n> > \tif ($have_email_valid) {\n> > \t\t$address =~ s/^<(.*)>$/$1/;\n\n\t$address =~ s/^\\s*<(.*)>\\s*$/$1/;\n\n-- \nCheers,\nStephen Rothwell                    sfr@canb.auug.org.au\nhttp://www.canb.auug.org.au/~sfr/\n"},{"id":"47309","messageId":"20070714040050.GA11773@kroah.com","threadId":"9016","inReplyTo":"20070713182818.fd37372f.sfr@canb.auug.org.au","subject":"Re: [PATCH] make git-send-email.perl handle email addresses with no names when Email::Valid is present","fromName":"Greg KH","fromEmail":"greg@kroah.com","sentAt":"2007-07-14T04:00:50Z","receivedAt":"2007-07-14T04:00:50Z","isPatch":true,"sender":{"key":"greg@kroah.com","avatar":"https://gravatar.com/avatar/5bb5aa0cc2e01c00ec899d11130c07796bc186e465bae57bc34873b13b72c7c8?d=mp&s=160"},"body":"On Fri, Jul 13, 2007 at 06:28:18PM +1000, Stephen Rothwell wrote:\n> On Thu, 12 Jul 2007 23:34:14 -0700 Greg KH <greg@kroah.com> wrote:\n> >\n> > On Thu, Jul 12, 2007 at 10:47:17PM -0700, Junio C Hamano wrote:\n> > > Greg KH <greg@kroah.com> writes:\n> > > \n> > > > When using git-send-email.perl on a changeset that has:\n> > > > \tCc: <stable@kernel.org>\n> > > > in the body of the description, and the Email::Valid perl module is\n> > > > installed on the system, the email address will be deemed \"invalid\" for\n> > > > some reason (Email::Valid isn't smart enough to handle this?) and\n> > > > complain and not send the address the email.\n> > > \n> > > That appears to be the case.\n> > > \n> > >         bad foo\n> > >         bad <foo@bar.baz>\n> > >         ok  foo@bar.baz\n> > >         ok  Foo <foo@bar.baz>\n> \n> This would be a bug in Email::Valid as it complains that the second\n> address fails the rfc822 check, however rfc822 says that the \"display\n> name\" before the '<' is optional.\n\nI agree, do you know how to get such a fix made?\n\nthanks,\n\ngreg k-h\n"},{"id":"47340","messageId":"20070714203842.bf6c43cc.sfr@canb.auug.org.au","threadId":"9016","inReplyTo":"20070714040050.GA11773@kroah.com","subject":"Re: [PATCH] make git-send-email.perl handle email addresses with no names when Email::Valid is present","fromName":"Stephen Rothwell","fromEmail":"sfr@canb.auug.org.au","sentAt":"2007-07-14T10:38:42Z","receivedAt":"2007-07-14T10:38:42Z","isPatch":true,"sender":{"key":"sfr@canb.auug.org.au","avatar":null},"body":"On Fri, 13 Jul 2007 21:00:50 -0700 Greg KH <greg@kroah.com> wrote:\n>\n> On Fri, Jul 13, 2007 at 06:28:18PM +1000, Stephen Rothwell wrote:\n> > \n> > This would be a bug in Email::Valid as it complains that the second\n> > address fails the rfc822 check, however rfc822 says that the \"display\n> > name\" before the '<' is optional.\n> \n> I agree, do you know how to get such a fix made?\n\nI would be inclined to make it my distribution's problem :-) i.e. on\nDebian I would report a bug against libemail-valid-perl.\n\n-- \nCheers,\nStephen Rothwell                    sfr@canb.auug.org.au\nhttp://www.canb.auug.org.au/~sfr/\n"},{"id":"50316","messageId":"20070809122859.GA5130@cassiopeia","threadId":"9016","inReplyTo":"20070713041749.GA28824@kroah.com","subject":"Re: [PATCH] make git-send-email.perl handle email addresses with no names when Email::Valid is present","fromName":"Uwe Kleine-König","fromEmail":"ukleinek@informatik.uni-freiburg.de","sentAt":"2007-08-09T12:28:59Z","receivedAt":"2007-08-09T12:28:59Z","isPatch":true,"sender":{"key":"u.kleine-koenig@pengutronix.de","avatar":"https://gravatar.com/avatar/354b5e3ceb2806a2f1e1e382ac29ddbdad18288654da62b61eb13583a857eee7?d=mp&s=160"},"body":"Hello,\n\nGreg KH wrote:\n> When using git-send-email.perl on a changeset that has:\n> \tCc: <stable@kernel.org>\n> in the body of the description, and the Email::Valid perl module is\n> installed on the system, the email address will be deemed \"invalid\" for\n> some reason (Email::Valid isn't smart enough to handle this?) and\n> complain and not send the address the email.\nThe reason is probably that it is indeed invalid.  From rfc822:\n\nmailbox\t\t= addr-spec / phrase route-addr\naddr-spec\t= local-part \"@\" domain\nphrase\t\t= 1*word\nword\t\t= atom / quoted-string\natom\t\t= 1*<any CHAR except specials, SPACE and CTLs>\nquoted-string\t= <\"> *(qtext/quoted-pair) <\">\nroute-addr\t= \"<\" [route] addr-spec \">\"\n...\n\nwhere 1* means \"at least one of\".\n\nThat is, either you must not use <...> or you need a non-empty phrase.\n\nActually this grammar looks wrong, because as I read it it would not\nallow spaces between words in phrase.  But that's another issue.\n\nBTW: Outlook depends on this, because if you use Cc:\n<stable@kernel.org>, it doesn't show anything in the Cc: line---at least\nin the default configuration.\n\nSo I suggest the following:\n\n---- >8 ----\nsend-email: rfc822 forbids using <address@domain> without a non-empty \"phrase\"\n\nEmail::Valid does respect this considering such a mailbox specification\ninvalid.  b06c6bc831cbb9e9eb82fd3ffd5a2b674cd940d0 addressed the issue, but\nonly if Email::Valid is available.\n\nSigned-off-by: Uwe Kleine-König <ukleinek@informatik.uni-freiburg.de>\n---\n git-send-email.perl |    2 +-\n 1 files changed, 1 insertions(+), 1 deletions(-)\n\ndiff --git a/git-send-email.perl b/git-send-email.perl\nindex 39e433b..a02ab96 100755\n--- a/git-send-email.perl\n+++ b/git-send-email.perl\n@@ -408,8 +408,8 @@ sub extract_valid_address {\n \t# check for a local address:\n \treturn $address if ($address =~ /^($local_part_regexp)$/);\n \n+\t$address =~ s/^\\s*<(.*)>\\s*$/$1/;\n \tif ($have_email_valid) {\n-\t\t$address =~ s/^\\s*<(.*)>\\s*$/$1/;\n \t\treturn scalar Email::Valid->address($address);\n \t} else {\n \t\t# less robust/correct than the monster regexp in Email::Valid,\n-- \n1.5.3.rc3.943.g14c81\n\n-- \nUwe Kleine-König\n\nIf a lawyer and an IRS agent were both drowning, and you could only save\none of them, would you go to lunch or read the paper?\n"}]}