All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Uwe Kleine-König" <ukleinek@informatik.uni-freiburg.de>
To: Greg KH <greg@kroah.com>
Cc: Junio C Hamano <gitster@pobox.com>, git@vger.kernel.org
Subject: Re: [PATCH] make git-send-email.perl handle email addresses with no names when Email::Valid is present
Date: Thu, 9 Aug 2007 14:28:59 +0200	[thread overview]
Message-ID: <20070809122859.GA5130@cassiopeia> (raw)
In-Reply-To: <20070713041749.GA28824@kroah.com>

Hello,

Greg KH wrote:
> When using git-send-email.perl on a changeset that has:
> 	Cc: <stable@kernel.org>
> 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.
The reason is probably that it is indeed invalid.  From rfc822:

mailbox		= addr-spec / phrase route-addr
addr-spec	= local-part "@" domain
phrase		= 1*word
word		= atom / quoted-string
atom		= 1*<any CHAR except specials, SPACE and CTLs>
quoted-string	= <"> *(qtext/quoted-pair) <">
route-addr	= "<" [route] addr-spec ">"
...

where 1* means "at least one of".

That is, either you must not use <...> or you need a non-empty phrase.

Actually this grammar looks wrong, because as I read it it would not
allow spaces between words in phrase.  But that's another issue.

BTW: Outlook depends on this, because if you use Cc:
<stable@kernel.org>, it doesn't show anything in the Cc: line---at least
in the default configuration.

So I suggest the following:

---- >8 ----
send-email: rfc822 forbids using <address@domain> without a non-empty "phrase"

Email::Valid does respect this considering such a mailbox specification
invalid.  b06c6bc831cbb9e9eb82fd3ffd5a2b674cd940d0 addressed the issue, but
only if Email::Valid is available.

Signed-off-by: Uwe Kleine-König <ukleinek@informatik.uni-freiburg.de>
---
 git-send-email.perl |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/git-send-email.perl b/git-send-email.perl
index 39e433b..a02ab96 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -408,8 +408,8 @@ sub extract_valid_address {
 	# check for a local address:
 	return $address if ($address =~ /^($local_part_regexp)$/);
 
+	$address =~ s/^\s*<(.*)>\s*$/$1/;
 	if ($have_email_valid) {
-		$address =~ s/^\s*<(.*)>\s*$/$1/;
 		return scalar Email::Valid->address($address);
 	} else {
 		# less robust/correct than the monster regexp in Email::Valid,
-- 
1.5.3.rc3.943.g14c81

-- 
Uwe Kleine-König

If a lawyer and an IRS agent were both drowning, and you could only save
one of them, would you go to lunch or read the paper?

      parent reply	other threads:[~2007-08-09 12:29 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-13  4:17 [PATCH] make git-send-email.perl handle email addresses with no names when Email::Valid is present Greg KH
2007-07-13  5:47 ` Junio C Hamano
2007-07-13  6:34   ` Greg KH
2007-07-13  8:28     ` Stephen Rothwell
2007-07-14  4:00       ` Greg KH
2007-07-14 10:38         ` Stephen Rothwell
2007-08-09 12:28 ` Uwe Kleine-König [this message]

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=20070809122859.GA5130@cassiopeia \
    --to=ukleinek@informatik.uni-freiburg.de \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=greg@kroah.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 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.