Re: Failure to extra stable@vger.kernel.org addresses

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

Re: Failure to extra stable@vger.kernel.org addresses

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

Krzysztof Mazur [off-list ref] writes:
quoted hunk
On Mon, Nov 19, 2012 at 11:57:47AM +0200, Felipe Balbi wrote:
quoted
Hi guys,

for whatever reason my git has started acting up with
stable@vger.kernel.org addresses. It doesn't manage to extract a valid
adress from the string:

 Cc: [off-list ref] # v3.4 v3.5 v3.6

Removing the comment at the end of the line makes things work again. I
do remember, however, seeing this working since few weeks back I sent a
mail to stable (in fact the same one I'm using to test), so this could
be related to some perl updates, who knows ?!?
You probably just installed Email::Valid package.

The current git-send-email works a little better and just prints an error:

W: unable to extract a valid address from: [off-list ref] #v3.4 v3.5 v3.6


This patch should fix the problem, now after <email> any garbage is
removed while extracting address.
diff --git a/git-send-email.perl b/git-send-email.perl
index 5a7c29d..bb659da 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -828,7 +828,7 @@ sub extract_valid_address {
 	# check for a local address:
 	return $address if ($address =~ /^($local_part_regexp)$/);
 
-	$address =~ s/^\s*<(.*)>\s*$/$1/;
+	$address =~ s/^\s*<(.*)>.*$/$1/;
 	if ($have_email_valid) {
 		return scalar Email::Valid->address($address);
 	} else {
Given that the problematic line

	Stable Kernel Maintainance Track [off-list ref] # vX.Y

is not even a valid e-mail address, doesn't this new logic belong to
sanitize_address() conceptually?

Re: Failure to extra stable@vger.kernel.org addresses

From: Felipe Contreras <hidden>
Date: 2016-06-15 22:55:22

On Mon, Nov 19, 2012 at 8:27 PM, Junio C Hamano [off-list ref] wrote:
Krzysztof Mazur [off-list ref] writes:
quoted
On Mon, Nov 19, 2012 at 11:57:47AM +0200, Felipe Balbi wrote:
quoted
Hi guys,

for whatever reason my git has started acting up with
stable@vger.kernel.org addresses. It doesn't manage to extract a valid
adress from the string:

 Cc: [off-list ref] # v3.4 v3.5 v3.6

Removing the comment at the end of the line makes things work again. I
do remember, however, seeing this working since few weeks back I sent a
mail to stable (in fact the same one I'm using to test), so this could
be related to some perl updates, who knows ?!?
You probably just installed Email::Valid package.

The current git-send-email works a little better and just prints an error:

W: unable to extract a valid address from: [off-list ref] #v3.4 v3.5 v3.6


This patch should fix the problem, now after <email> any garbage is
removed while extracting address.
diff --git a/git-send-email.perl b/git-send-email.perl
index 5a7c29d..bb659da 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -828,7 +828,7 @@ sub extract_valid_address {
      # check for a local address:
      return $address if ($address =~ /^($local_part_regexp)$/);

-     $address =~ s/^\s*<(.*)>\s*$/$1/;
+     $address =~ s/^\s*<(.*)>.*$/$1/;
      if ($have_email_valid) {
              return scalar Email::Valid->address($address);
      } else {
Given that the problematic line

        Stable Kernel Maintainance Track [off-list ref] # vX.Y

is not even a valid e-mail address, doesn't this new logic belong to
sanitize_address() conceptually?
That would be great, it would also help the cc-cmd stuff. The
get_maintainer.pl patch from the Linux kernel outputs something like:

David Airlie [off-list ref] (maintainer:DRM DRIVERS)
Ben Skeggs [off-list ref]
(commit_signer:17/19=89%,commit_signer:43/46=93%)
Maxim Levitsky [off-list ref] (commit_signer:3/19=16%)
Greg Kroah-Hartman [off-list ref] (commit_signer:2/19=11%)
Dave Airlie [off-list ref] (commit_signer:2/19=11%,commit_signer:3/46=7%)
Alex Deucher [off-list ref] (commit_signer:1/19=5%)
dri-devel@lists.freedesktop.org (open list:DRM DRIVERS)
linux-kernel@vger.kernel.org (open list)

-- 
Felipe Contreras

Re: Failure to extra stable@vger.kernel.org addresses

From: Krzysztof Mazur <hidden>
Date: 2016-06-15 22:55:22

On Mon, Nov 19, 2012 at 11:27:45AM -0800, Junio C Hamano wrote:
Given that the problematic line

	Stable Kernel Maintainance Track [off-list ref] # vX.Y

is not even a valid e-mail address, doesn't this new logic belong to
sanitize_address() conceptually?
Yes, it's much better to do it in the sanitize_address().

Felipe, may you check it?

Krzysiek
-- >8 --
Subject: [PATCH] git-send-email: remove garbage after email address

In some cases it's very useful to add some additional information
after email in Cc-list, for instance:

"Cc: Stable kernel [off-list ref] #v3.4 v3.5 v3.6"

Currently the git refuses to add such invalid email to Cc-list,
when the Email::Valid perl module is available or just uses whole line
as the email address.

Now in sanitize_address() everything after the email address is
removed, so the resulting line is correct email address and Email::Valid
validates it correctly.

Signed-off-by: Krzysztof Mazur <redacted>
---
 git-send-email.perl | 4 ++++
 1 file changed, 4 insertions(+)
diff --git a/git-send-email.perl b/git-send-email.perl
index 5a7c29d..9840d0a 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -924,6 +924,10 @@ sub quote_subject {
 # use the simplest quoting being able to handle the recipient
 sub sanitize_address {
 	my ($recipient) = @_;
+
+	# remove garbage after email address
+	$recipient =~ s/(.*>).*$/$1/;
+
 	my ($recipient_name, $recipient_addr) = ($recipient =~ /^(.*?)\s*(<.*)/);
 
 	if (not $recipient_name) {
-- 
1.8.0.283.gc57d856

Re: Failure to extra stable@vger.kernel.org addresses

From: Felipe Contreras <hidden>
Date: 2016-06-15 22:55:22

On Mon, Nov 19, 2012 at 11:58 PM, Krzysztof Mazur [off-list ref] wrote:
quoted hunk
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -924,6 +924,10 @@ sub quote_subject {
 # use the simplest quoting being able to handle the recipient
 sub sanitize_address {
        my ($recipient) = @_;
+
+       # remove garbage after email address
+       $recipient =~ s/(.*>).*$/$1/;
+
Looks fine, but I would do s/(.*?>)(.*)$/$1/, so that 'test
[off-list ref] <#comment>' gets the second comment removed.

Cheers.

-- 
Felipe Contreras

Re: Failure to extra stable@vger.kernel.org addresses

From: Felipe Balbi <hidden>
Date: 2016-06-15 22:55:22

On Mon, Nov 19, 2012 at 11:58:38PM +0100, Krzysztof Mazur wrote:
On Mon, Nov 19, 2012 at 11:27:45AM -0800, Junio C Hamano wrote:
quoted
Given that the problematic line

	Stable Kernel Maintainance Track [off-list ref] # vX.Y

is not even a valid e-mail address, doesn't this new logic belong to
sanitize_address() conceptually?
Yes, it's much better to do it in the sanitize_address().

Felipe, may you check it?

Krzysiek
-- >8 --
Subject: [PATCH] git-send-email: remove garbage after email address

In some cases it's very useful to add some additional information
after email in Cc-list, for instance:

"Cc: Stable kernel [off-list ref] #v3.4 v3.5 v3.6"

Currently the git refuses to add such invalid email to Cc-list,
when the Email::Valid perl module is available or just uses whole line
as the email address.

Now in sanitize_address() everything after the email address is
removed, so the resulting line is correct email address and Email::Valid
validates it correctly.

Signed-off-by: Krzysztof Mazur <redacted>
Tested-by: Felipe Balbi <redacted>
quoted hunk
---
 git-send-email.perl | 4 ++++
 1 file changed, 4 insertions(+)
diff --git a/git-send-email.perl b/git-send-email.perl
index 5a7c29d..9840d0a 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -924,6 +924,10 @@ sub quote_subject {
 # use the simplest quoting being able to handle the recipient
 sub sanitize_address {
 	my ($recipient) = @_;
+
+	# remove garbage after email address
+	$recipient =~ s/(.*>).*$/$1/;
+
 	my ($recipient_name, $recipient_addr) = ($recipient =~ /^(.*?)\s*(<.*)/);
 
 	if (not $recipient_name) {
-- 
1.8.0.283.gc57d856
-- 
balbi
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help