git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 2/3] send-email: only consider lines containing @ or <> for automatic Cc'ing

From
Rasmus Villemoes <rv@rasmusvillemoes.dk>
Date
Oct 10, 2018, 11:13 UTC
Message-ID
<20181010111351.5045-3-rv@rasmusvillemoes.dk>
In-Reply-To
<20181010111351.5045-1-rv@rasmusvillemoes.dk>

While the address sanitizations routines do accept local addresses, that is almost never what is meant in a Cc or Signed-off-by trailer.

Looking through all the signed-off-by lines in the linux kernel tree without a @, there are mostly two patterns: Either just a full name, or a full name followed by <user at domain.com> (i.e., with the word at instead of a @), and minor variations. For cc lines, the same patterns appear, along with lots of "cc stable" variations that do not actually name stable@vger.kernel.org

  Cc: stable # introduced pre-git times
  cc: stable.kernel.org

In the <user at domain.com> cases, one gets a chance to interactively fix it. But when there is no <> pair, it seems we end up just using the first word as a (local) address.

As the number of cases where a local address really was meant is likely (and anecdotally) quite small compared to the number of cases where we end up cc'ing a garbage address, insist on at least a @ or a <> pair being present.

This is also preparation for the next patch, where we are likely to encounter even more non-addresses in -by lines, such as

  Reported-by: Coverity
  Patch-generated-by: Coccinelle
Signed-off-by: Rasmus Villemoes <rv@rasmusvillemoes.dk>
---
 git-send-email.perl | 5 +++++
 1 file changed, 5 insertions(+)
diff --git a/git-send-email.perl b/git-send-email.perl
index 2be5dac337..1916159d2a 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -1694,6 +1694,11 @@ sub process_file {
 				next if $suppress_cc{'sob'} and $what =~ /Signed-off-by/i;
 				next if $suppress_cc{'bodycc'} and $what =~ /Cc/i;
 			}
+			if ($c !~ /.+@.+|<.+>/) {
+				printf("(body) Ignoring %s from line '%s'\n",
+					$what, $_) unless $quiet;
+				next;
+			}
 			push @cc, $c;
 			printf(__("(body) Adding cc: %s from line '%s'\n"),
 				$c, $_) unless $quiet;
-- 
2.19.1.6.g084f1d7761
Previous: Rasmus VillemoesNext: Ævar Arnfjörð Bjarmason
Message 3 of 20 in “send-email: Also pick up cc addresses from -by trailers”
  1. 0/3 send-email: Also pick up cc addresses from -by trailersRasmus Villemoes, Oct 10, 2018
  2. 1/3 Documentation/git-send-email.txt: style fixesRasmus Villemoes, Oct 10, 2018
  3. 2/3 send-email: only consider lines containing @ or <> for automatic Cc'ingRasmus Villemoes, Oct 10, 2018
  4. Ævar Arnfjörð BjarmasonOct 10, 2018
  5. Rasmus VillemoesOct 10, 2018
  6. Junio C HamanoOct 11, 2018
  7. Rasmus VillemoesOct 11, 2018
  8. Junio C HamanoOct 11, 2018
  9. 3/3 send-email: also pick up cc addresses from -by trailersRasmus Villemoes, Oct 10, 2018
  10. Ævar Arnfjörð BjarmasonOct 10, 2018
  11. Junio C HamanoOct 11, 2018
  12. Rasmus VillemoesOct 11, 2018
  13. Junio C HamanoOct 16, 2018
  14. Rasmus VillemoesOct 16, 2018
  15. Junio C HamanoOct 16, 2018
  16. 0/3 send-email: Also pick up cc addresses from -by trailersRasmus Villemoes, Oct 16, 2018
  17. 1/3 Documentation/git-send-email.txt: style fixesRasmus Villemoes, Oct 16, 2018
  18. 2/3 send-email: only consider lines containing @ or <> for automatic Cc'ingRasmus Villemoes, Oct 16, 2018
  19. 3/3 send-email: also pick up cc addresses from -by trailersRasmus Villemoes, Oct 16, 2018
  20. Junio C HamanoOct 16, 2018

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.