threads / rfc / 56968

patchRe: [RFC PATCH v1 1/1] docs: add the new commit-msg tags 'Reported:' and 'Reviewed:'

Subject: Re: [RFC PATCH v1 1/1] docs: add the new commit-msg tags 'Reported:' and 'Reviewed:'

## tl;dr

19 messages between Nov 23, 2021 and Dec 8, 2021. Diffs are folded; open one to read it.

replies: 18people: 7as markdown or json

Eric Wong· Nov 23, 2021, 18:52 UTC · lore
Thorsten Leemhuis <linux@leemhuis.info> wrote:
> diff --git a/Documentation/maintainer/configure-git.rst b/Documentation/maintainer/configure-git.rst
> index 80ae5030a590..8429d45d661c 100644
> --- a/Documentation/maintainer/configure-git.rst
> +++ b/Documentation/maintainer/configure-git.rst
<snip>, +cc git@vger
Show 6 quoted lines
> @@ -56,7 +56,7 @@ by adding the following hook into your git:
>  	$ cat >.git/hooks/applypatch-msg <<'EOF'
>  	#!/bin/sh
>  	. git-sh-setup
> -	perl -pi -e 's|^Message-Id:\s*<?([^>]+)>?$|Link: https://lore.kernel.org/r/$1|g;' "$1"
> +	perl -pi -e 's|^Message-Id:\s*<?([^>]+)>?$|Reviewed: https://lore.kernel.org/r/$1|g;' "$1"

Side note: that regexp should match "Message-ID" case-insensitively. git send-email is an outlier in its capitalization of "Message-Id", most RFCs capitalize it "Message-ID", as do common MUAs.

git send-email's capitalization does annoy me and I've looked into changing it; but there's a bunch of tests and probably dependent code that also need to be updated...

Junio C Hamano· Nov 24, 2021, 01:37 UTC · re: Eric Wong · lore
Eric Wong <e@80x24.org> writes:
> git send-email's capitalization does annoy me and I've looked
> into changing it; but there's a bunch of tests and probably
> dependent code that also need to be updated...

It does annoy me, too, and I do not mind if it gets "fixed", but I do not know if the cost for vetting a bulk update like that is worth it. There is another one outside send-email in log-tree.c that is responsible for output from format-patch.

Here is the extent of damage in my trial change that seems to pass the tests locally.

 Documentation/MyFirstContribution.txt | 14 ++++-----
 Documentation/git-format-patch.txt    |  4 +--
 Documentation/git-send-email.txt      |  2 +-
 git-send-email.perl                   |  4 +--
 log-tree.c                            |  2 +-
 mailinfo.c                            |  4 +--
 t/t4014-format-patch.sh               | 56 +++++++++++++++++------------------
 t/t4150-am.sh                         |  8 ++---
 t/t4258/mbox                          |  2 +-
 t/t5100/msg0002                       |  2 +-
 t/t5100/msg0003                       |  2 +-
 t/t5100/msg0012--message-id           |  2 +-
 t/t5100/quoted-cr.mbox                |  4 +--
 t/t5100/sample.mbox                   |  6 ++--
 t/t9001-send-email.sh                 | 38 ++++++++++++------------
 15 files changed, 75 insertions(+), 75 deletions(-)
Show changes to diff +75 −75
diff --git i/Documentation/MyFirstContribution.txt w/Documentation/MyFirstContribution.txt
index b20bc8e914..91cb204d52 100644
--- i/Documentation/MyFirstContribution.txt
+++ w/Documentation/MyFirstContribution.txt
@@ -1071,21 +1071,21 @@ between your last version and now, if it's something significant. You do not
 need the exact same body in your second cover letter; focus on explaining to
 reviewers the changes you've made that may not be as visible.
 
-You will also need to go and find the Message-Id of your previous cover letter.
+You will also need to go and find the Message-ID of your previous cover letter.
 You can either note it when you send the first series, from the output of `git
 send-email`, or you can look it up on the
 https://lore.kernel.org/git[mailing list]. Find your cover letter in the
-archives, click on it, then click "permalink" or "raw" to reveal the Message-Id
+archives, click on it, then click "permalink" or "raw" to reveal the Message-ID
 header. It should match:
 
 ----
-Message-Id: <foo.12345.author@example.com>
+Message-ID: <foo.12345.author@example.com>
 ----
 
-Your Message-Id is `<foo.12345.author@example.com>`. This example will be used
-below as well; make sure to replace it with the correct Message-Id for your
-**previous cover letter** - that is, if you're sending v2, use the Message-Id
-from v1; if you're sending v3, use the Message-Id from v2.
+Your Message-ID is `<foo.12345.author@example.com>`. This example will be used
+below as well; make sure to replace it with the correct Message-ID for your
+**previous cover letter** - that is, if you're sending v2, use the Message-ID
+from v1; if you're sending v3, use the Message-ID from v2.
 
 While you're looking at the email, you should also note who is CC'd, as it's
 common practice in the mailing list to keep all CCs on a thread. You can add
diff --git i/Documentation/git-format-patch.txt w/Documentation/git-format-patch.txt
index 113eabc107..daf911f249 100644
--- i/Documentation/git-format-patch.txt
+++ w/Documentation/git-format-patch.txt
@@ -99,7 +99,7 @@ To omit patch numbers from the subject, use `-N`.
 
 If given `--thread`, `git-format-patch` will generate `In-Reply-To` and
 `References` headers to make the second and subsequent patch mails appear
-as replies to the first mail; this also generates a `Message-Id` header to
+as replies to the first mail; this also generates a `Message-ID` header to
 reference.
 
 OPTIONS
@@ -163,7 +163,7 @@ include::diff-options.txt[]
 --no-thread::
 	Controls addition of `In-Reply-To` and `References` headers to
 	make the second and subsequent mails appear as replies to the
-	first.  Also controls generation of the `Message-Id` header to
+	first.  Also controls generation of the `Message-ID` header to
 	reference.
 +
 The optional <style> argument can be either `shallow` or `deep`.
diff --git i/Documentation/git-send-email.txt w/Documentation/git-send-email.txt
index 3db4eab4ba..086f132229 100644
--- i/Documentation/git-send-email.txt
+++ w/Documentation/git-send-email.txt
@@ -91,7 +91,7 @@ See the CONFIGURATION section for `sendemail.multiEdit`.
 
 --in-reply-to=<identifier>::
 	Make the first mail (or all the mails with `--no-thread`) appear as a
-	reply to the given Message-Id, which avoids breaking threads to
+	reply to the given Message-ID, which avoids breaking threads to
 	provide a new patch series.
 	The second and subsequent emails will be sent as replies according to
 	the `--[no-]chain-reply-to` setting.
diff --git i/git-send-email.perl w/git-send-email.perl
index 5262d88ee3..a61134c7d3 100755
--- i/git-send-email.perl
+++ w/git-send-email.perl
@@ -1494,7 +1494,7 @@ sub send_message {
 To: $to${ccline}
 Subject: $subject
 Date: $date
-Message-Id: $message_id
+Message-ID: $message_id
 ";
 	if ($use_xmailer) {
 		$header .= "X-Mailer: git-send-email $gitversion\n";
@@ -1789,7 +1789,7 @@ sub process_file {
 				$has_mime_version = 1;
 				push @xh, $_;
 			}
-			elsif (/^Message-Id: (.*)/i) {
+			elsif (/^Message-ID: (.*)/i) {
 				$message_id = $1;
 			}
 			elsif (/^Content-Transfer-Encoding: (.*)/i) {
diff --git i/log-tree.c w/log-tree.c
index 644893fd8c..818cea5f12 100644
--- i/log-tree.c
+++ w/log-tree.c
@@ -428,7 +428,7 @@ void log_write_email_headers(struct rev_info *opt, struct commit *commit,
 	fprintf(opt->diffopt.file, "From %s Mon Sep 17 00:00:00 2001\n", name);
 	graph_show_oneline(opt->graph);
 	if (opt->message_id) {
-		fprintf(opt->diffopt.file, "Message-Id: <%s>\n", opt->message_id);
+		fprintf(opt->diffopt.file, "Message-ID: <%s>\n", opt->message_id);
 		graph_show_oneline(opt->graph);
 	}
 	if (opt->ref_message_ids && opt->ref_message_ids->nr > 0) {
diff --git i/mailinfo.c w/mailinfo.c
index 02f6f95357..855349cc0e 100644
--- i/mailinfo.c
+++ w/mailinfo.c
@@ -597,7 +597,7 @@ static int check_header(struct mailinfo *mi,
 		ret = 1;
 		goto check_header_out;
 	}
-	if (parse_header(line, "Message-Id", mi, &sb)) {
+	if (parse_header(line, "Message-ID", mi, &sb)) {
 		if (mi->add_message_id)
 			mi->message_id = strbuf_detach(&sb, NULL);
 		ret = 1;
@@ -829,7 +829,7 @@ static int handle_commit_msg(struct mailinfo *mi, struct strbuf *line)
 	if (patchbreak(line)) {
 		if (mi->message_id)
 			strbuf_addf(&mi->log_message,
-				    "Message-Id: %s\n", mi->message_id);
+				    "Message-ID: %s\n", mi->message_id);
 		return 1;
 	}
 
diff --git i/t/t4014-format-patch.sh w/t/t4014-format-patch.sh
index 712d4b5ddf..973899d165 100755
--- i/t/t4014-format-patch.sh
+++ w/t/t4014-format-patch.sh
@@ -445,13 +445,13 @@ test_expect_success 'no threading' '
 
 cat >expect.thread <<EOF
 ---
-Message-Id: <0>
+Message-ID: <0>
 ---
-Message-Id: <1>
+Message-ID: <1>
 In-Reply-To: <0>
 References: <0>
 ---
-Message-Id: <2>
+Message-ID: <2>
 In-Reply-To: <0>
 References: <0>
 EOF
@@ -462,15 +462,15 @@ test_expect_success 'thread' '
 
 cat >expect.in-reply-to <<EOF
 ---
-Message-Id: <0>
+Message-ID: <0>
 In-Reply-To: <1>
 References: <1>
 ---
-Message-Id: <2>
+Message-ID: <2>
 In-Reply-To: <1>
 References: <1>
 ---
-Message-Id: <3>
+Message-ID: <3>
 In-Reply-To: <1>
 References: <1>
 EOF
@@ -482,17 +482,17 @@ test_expect_success 'thread in-reply-to' '
 
 cat >expect.cover-letter <<EOF
 ---
-Message-Id: <0>
+Message-ID: <0>
 ---
-Message-Id: <1>
+Message-ID: <1>
 In-Reply-To: <0>
 References: <0>
 ---
-Message-Id: <2>
+Message-ID: <2>
 In-Reply-To: <0>
 References: <0>
 ---
-Message-Id: <3>
+Message-ID: <3>
 In-Reply-To: <0>
 References: <0>
 EOF
@@ -503,21 +503,21 @@ test_expect_success 'thread cover-letter' '
 
 cat >expect.cl-irt <<EOF
 ---
-Message-Id: <0>
+Message-ID: <0>
 In-Reply-To: <1>
 References: <1>
 ---
-Message-Id: <2>
+Message-ID: <2>
 In-Reply-To: <0>
 References: <1>
 	<0>
 ---
-Message-Id: <3>
+Message-ID: <3>
 In-Reply-To: <0>
 References: <1>
 	<0>
 ---
-Message-Id: <4>
+Message-ID: <4>
 In-Reply-To: <0>
 References: <1>
 	<0>
@@ -535,13 +535,13 @@ test_expect_success 'thread explicit shallow' '
 
 cat >expect.deep <<EOF
 ---
-Message-Id: <0>
+Message-ID: <0>
 ---
-Message-Id: <1>
+Message-ID: <1>
 In-Reply-To: <0>
 References: <0>
 ---
-Message-Id: <2>
+Message-ID: <2>
 In-Reply-To: <1>
 References: <0>
 	<1>
@@ -553,16 +553,16 @@ test_expect_success 'thread deep' '
 
 cat >expect.deep-irt <<EOF
 ---
-Message-Id: <0>
+Message-ID: <0>
 In-Reply-To: <1>
 References: <1>
 ---
-Message-Id: <2>
+Message-ID: <2>
 In-Reply-To: <0>
 References: <1>
 	<0>
 ---
-Message-Id: <3>
+Message-ID: <3>
 In-Reply-To: <2>
 References: <1>
 	<0>
@@ -576,18 +576,18 @@ test_expect_success 'thread deep in-reply-to' '
 
 cat >expect.deep-cl <<EOF
 ---
-Message-Id: <0>
+Message-ID: <0>
 ---
-Message-Id: <1>
+Message-ID: <1>
 In-Reply-To: <0>
 References: <0>
 ---
-Message-Id: <2>
+Message-ID: <2>
 In-Reply-To: <1>
 References: <0>
 	<1>
 ---
-Message-Id: <3>
+Message-ID: <3>
 In-Reply-To: <2>
 References: <0>
 	<1>
@@ -600,22 +600,22 @@ test_expect_success 'thread deep cover-letter' '
 
 cat >expect.deep-cl-irt <<EOF
 ---
-Message-Id: <0>
+Message-ID: <0>
 In-Reply-To: <1>
 References: <1>
 ---
-Message-Id: <2>
+Message-ID: <2>
 In-Reply-To: <0>
 References: <1>
 	<0>
 ---
-Message-Id: <3>
+Message-ID: <3>
 In-Reply-To: <2>
 References: <1>
 	<0>
 	<2>
 ---
-Message-Id: <4>
+Message-ID: <4>
 In-Reply-To: <3>
 References: <1>
 	<0>
diff --git i/t/t4150-am.sh w/t/t4150-am.sh
index 2aaaa0d7de..f41418c6e9 100755
--- i/t/t4150-am.sh
+++ w/t/t4150-am.sh
@@ -103,7 +103,7 @@ test_expect_success setup '
 
 	git format-patch --stdout first >patch1 &&
 	{
-		echo "Message-Id: <1226501681-24923-1-git-send-email-bda@mnsspb.ru>" &&
+		echo "Message-ID: <1226501681-24923-1-git-send-email-bda@mnsspb.ru>" &&
 		echo "X-Fake-Field: Line One" &&
 		echo "X-Fake-Field: Line Two" &&
 		echo "X-Fake-Field: Line Three" &&
@@ -916,7 +916,7 @@ test_expect_success 'am --message-id really adds the message id' '
 	git am --message-id patch1.eml &&
 	test_path_is_missing .git/rebase-apply &&
 	git cat-file commit HEAD | tail -n1 >actual &&
-	grep Message-Id patch1.eml >expected &&
+	grep Message-ID patch1.eml >expected &&
 	test_cmp expected actual
 '
 
@@ -928,7 +928,7 @@ test_expect_success 'am.messageid really adds the message id' '
 	git am patch1.eml &&
 	test_path_is_missing .git/rebase-apply &&
 	git cat-file commit HEAD | tail -n1 >actual &&
-	grep Message-Id patch1.eml >expected &&
+	grep Message-ID patch1.eml >expected &&
 	test_cmp expected actual
 '
 
@@ -939,7 +939,7 @@ test_expect_success 'am --message-id -s signs off after the message id' '
 	git am -s --message-id patch1.eml &&
 	test_path_is_missing .git/rebase-apply &&
 	git cat-file commit HEAD | tail -n2 | head -n1 >actual &&
-	grep Message-Id patch1.eml >expected &&
+	grep Message-ID patch1.eml >expected &&
 	test_cmp expected actual
 '
 
diff --git i/t/t4258/mbox w/t/t4258/mbox
index c62819f3d2..1ae528ba78 100644
--- i/t/t4258/mbox
+++ w/t/t4258/mbox
@@ -2,7 +2,7 @@ From: A U Thor <mail@example.com>
 To: list@example.org
 Subject: [PATCH v2] sample
 Date: Mon,  3 Aug 2020 22:40:55 +0700
-Message-Id: <msg-id@example.com>
+Message-ID: <msg-id@example.com>
 Content-Type: text/plain; charset="utf-8"
 Content-Transfer-Encoding: base64
 
diff --git i/t/t5100/msg0002 w/t/t5100/msg0002
index e2546ec733..1089382425 100644
--- i/t/t5100/msg0002
+++ w/t/t5100/msg0002
@@ -3,7 +3,7 @@ message:
 
 From: Nit Picker <nit.picker@example.net>
 Subject: foo is too old
-Message-Id: <nitpicker.12121212@example.net>
+Message-ID: <nitpicker.12121212@example.net>
 
 Hopefully this would fix the problem stated there.
 
diff --git i/t/t5100/msg0003 w/t/t5100/msg0003
index 1ac68101b1..3402b534a6 100644
--- i/t/t5100/msg0003
+++ w/t/t5100/msg0003
@@ -3,7 +3,7 @@ message:
 
 From: Nit Picker <nit.picker@example.net>
 Subject: foo is too old
-Message-Id: <nitpicker.12121212@example.net>
+Message-ID: <nitpicker.12121212@example.net>
 
 Hopefully this would fix the problem stated there.
 
diff --git i/t/t5100/msg0012--message-id w/t/t5100/msg0012--message-id
index 376e26e9ae..44482958ce 100644
--- i/t/t5100/msg0012--message-id
+++ w/t/t5100/msg0012--message-id
@@ -5,4 +5,4 @@ docutils заменён на python-docutils
 python-docutils. В то время как сам rest2web не нужен.
 
 Signed-off-by: Dmitriy Blinov <bda@mnsspb.ru>
-Message-Id: <1226501681-24923-1-git-send-email-bda@mnsspb.ru>
+Message-ID: <1226501681-24923-1-git-send-email-bda@mnsspb.ru>
diff --git i/t/t5100/quoted-cr.mbox w/t/t5100/quoted-cr.mbox
index 909021bb7a..a529d4de08 100644
--- i/t/t5100/quoted-cr.mbox
+++ w/t/t5100/quoted-cr.mbox
@@ -3,7 +3,7 @@ From: A U Thor <mail@example.com>
 To: list@example.org
 Subject: [PATCH v2] sample
 Date: Mon,  3 Aug 2020 22:40:55 +0700
-Message-Id: <msg-id@example.com>
+Message-ID: <msg-id@example.com>
 Content-Type: text/plain; charset="utf-8"
 Content-Transfer-Encoding: base64
 
@@ -27,7 +27,7 @@ From: A U Thor <mail@example.com>
 To: list@example.org
 Subject: [PATCH v2] sample
 Date: Mon,  3 Aug 2020 22:40:55 +0700
-Message-Id: <msg-id2@example.com>
+Message-ID: <msg-id2@example.com>
 Content-Type: text/plain; charset="utf-8"
 Content-Transfer-Encoding: base64
 
diff --git i/t/t5100/sample.mbox w/t/t5100/sample.mbox
index 6d4d0e4474..4a54ee5171 100644
--- i/t/t5100/sample.mbox
+++ w/t/t5100/sample.mbox
@@ -35,7 +35,7 @@ message:
 
 From: Nit Picker <nit.picker@example.net>
 Subject: foo is too old
-Message-Id: <nitpicker.12121212@example.net>
+Message-ID: <nitpicker.12121212@example.net>
 
 Hopefully this would fix the problem stated there.
 
@@ -78,7 +78,7 @@ message:
 
 From: Nit Picker <nit.picker@example.net>
 Subject: foo is too old
-Message-Id: <nitpicker.12121212@example.net>
+Message-ID: <nitpicker.12121212@example.net>
 
 Hopefully this would fix the problem stated there.
 
@@ -508,7 +508,7 @@ From bda@mnsspb.ru Wed Nov 12 17:54:41 2008
 From: Dmitriy Blinov <bda@mnsspb.ru>
 To: navy-patches@dinar.mns.mnsspb.ru
 Date: Wed, 12 Nov 2008 17:54:41 +0300
-Message-Id: <1226501681-24923-1-git-send-email-bda@mnsspb.ru>
+Message-ID: <1226501681-24923-1-git-send-email-bda@mnsspb.ru>
 X-Mailer: git-send-email 1.5.6.5
 MIME-Version: 1.0
 Content-Type: text/plain;
diff --git i/t/t9001-send-email.sh w/t/t9001-send-email.sh
index aa0c20499b..ce09cf1fe3 100755
--- i/t/t9001-send-email.sh
+++ w/t/t9001-send-email.sh
@@ -11,7 +11,7 @@ PREREQ="PERL"
 
 replace_variable_fields () {
 	sed	-e "s/^\(Date:\).*/\1 DATE-STRING/" \
-		-e "s/^\(Message-Id:\).*/\1 MESSAGE-ID-STRING/" \
+		-e "s/^\(Message-ID:\).*/\1 MESSAGE-ID-STRING/" \
 		-e "s/^\(X-Mailer:\).*/\1 X-MAILER-STRING/"
 }
 
@@ -224,7 +224,7 @@ Cc: cc@example.com,
 	two@example.com
 Subject: [PATCH 1/1] Second.
 Date: DATE-STRING
-Message-Id: MESSAGE-ID-STRING
+Message-ID: MESSAGE-ID-STRING
 X-Mailer: X-MAILER-STRING
 In-Reply-To: <unique-message-id@example.com>
 References: <unique-message-id@example.com>
@@ -616,7 +616,7 @@ test_expect_success $PREREQ 'In-Reply-To without --chain-reply-to' '
 	sed -n -e "s/^In-Reply-To: *\(.*\)/\1/p" msgtxt1 >actual &&
 	test_cmp expect actual &&
 	# Second and subsequent messages are replies to the first one
-	sed -n -e "s/^Message-Id: *\(.*\)/\1/p" msgtxt1 >expect &&
+	sed -n -e "s/^Message-ID: *\(.*\)/\1/p" msgtxt1 >expect &&
 	sed -n -e "s/^In-Reply-To: *\(.*\)/\1/p" msgtxt2 >actual &&
 	test_cmp expect actual &&
 	sed -n -e "s/^In-Reply-To: *\(.*\)/\1/p" msgtxt3 >actual &&
@@ -636,10 +636,10 @@ test_expect_success $PREREQ 'In-Reply-To with --chain-reply-to' '
 		2>errors &&
 	sed -n -e "s/^In-Reply-To: *\(.*\)/\1/p" msgtxt1 >actual &&
 	test_cmp expect actual &&
-	sed -n -e "s/^Message-Id: *\(.*\)/\1/p" msgtxt1 >expect &&
+	sed -n -e "s/^Message-ID: *\(.*\)/\1/p" msgtxt1 >expect &&
 	sed -n -e "s/^In-Reply-To: *\(.*\)/\1/p" msgtxt2 >actual &&
 	test_cmp expect actual &&
-	sed -n -e "s/^Message-Id: *\(.*\)/\1/p" msgtxt2 >expect &&
+	sed -n -e "s/^Message-ID: *\(.*\)/\1/p" msgtxt2 >expect &&
 	sed -n -e "s/^In-Reply-To: *\(.*\)/\1/p" msgtxt3 >actual &&
 	test_cmp expect actual
 '
@@ -712,7 +712,7 @@ Cc: cc@example.com,
 	two@example.com
 Subject: [PATCH 1/1] Second.
 Date: DATE-STRING
-Message-Id: MESSAGE-ID-STRING
+Message-ID: MESSAGE-ID-STRING
 X-Mailer: X-MAILER-STRING
 MIME-Version: 1.0
 Content-Transfer-Encoding: 8bit
@@ -758,7 +758,7 @@ Cc: A <author@example.com>,
 	two@example.com
 Subject: [PATCH 1/1] Second.
 Date: DATE-STRING
-Message-Id: MESSAGE-ID-STRING
+Message-ID: MESSAGE-ID-STRING
 X-Mailer: X-MAILER-STRING
 MIME-Version: 1.0
 Content-Transfer-Encoding: 8bit
@@ -795,7 +795,7 @@ Cc: A <author@example.com>,
 	C O Mitter <committer@example.com>
 Subject: [PATCH 1/1] Second.
 Date: DATE-STRING
-Message-Id: MESSAGE-ID-STRING
+Message-ID: MESSAGE-ID-STRING
 X-Mailer: X-MAILER-STRING
 MIME-Version: 1.0
 Content-Transfer-Encoding: 8bit
@@ -823,7 +823,7 @@ From: Example <from@example.com>
 To: to@example.com
 Subject: [PATCH 1/1] Second.
 Date: DATE-STRING
-Message-Id: MESSAGE-ID-STRING
+Message-ID: MESSAGE-ID-STRING
 X-Mailer: X-MAILER-STRING
 MIME-Version: 1.0
 Content-Transfer-Encoding: 8bit
@@ -859,7 +859,7 @@ Cc: A <author@example.com>,
 	cc-cmd@example.com
 Subject: [PATCH 1/1] Second.
 Date: DATE-STRING
-Message-Id: MESSAGE-ID-STRING
+Message-ID: MESSAGE-ID-STRING
 X-Mailer: X-MAILER-STRING
 MIME-Version: 1.0
 Content-Transfer-Encoding: 8bit
@@ -892,7 +892,7 @@ Cc: A <author@example.com>,
 	two@example.com
 Subject: [PATCH 1/1] Second.
 Date: DATE-STRING
-Message-Id: MESSAGE-ID-STRING
+Message-ID: MESSAGE-ID-STRING
 X-Mailer: X-MAILER-STRING
 MIME-Version: 1.0
 Content-Transfer-Encoding: 8bit
@@ -925,7 +925,7 @@ Cc: A <author@example.com>,
 	two@example.com
 Subject: [PATCH 1/1] Second.
 Date: DATE-STRING
-Message-Id: MESSAGE-ID-STRING
+Message-ID: MESSAGE-ID-STRING
 X-Mailer: X-MAILER-STRING
 MIME-Version: 1.0
 Content-Transfer-Encoding: 8bit
@@ -962,7 +962,7 @@ Cc: A <author@example.com>,
 	C O Mitter <committer@example.com>
 Subject: [PATCH 1/1] Second.
 Date: DATE-STRING
-Message-Id: MESSAGE-ID-STRING
+Message-ID: MESSAGE-ID-STRING
 X-Mailer: X-MAILER-STRING
 MIME-Version: 1.0
 Content-Transfer-Encoding: 8bit
@@ -992,7 +992,7 @@ Cc: A <author@example.com>,
 	C O Mitter <committer@example.com>
 Subject: [PATCH 1/1] Second.
 Date: DATE-STRING
-Message-Id: MESSAGE-ID-STRING
+Message-ID: MESSAGE-ID-STRING
 X-Mailer: X-MAILER-STRING
 MIME-Version: 1.0
 Content-Transfer-Encoding: 8bit
@@ -1477,7 +1477,7 @@ test_expect_success $PREREQ 'To headers from files reset each patch' '
 test_expect_success $PREREQ 'setup expect' '
 cat >email-using-8bit <<\EOF
 From fe6ecc66ece37198fe5db91fa2fc41d9f4fe5cc4 Mon Sep 17 00:00:00 2001
-Message-Id: <bogus-message-id@example.com>
+Message-ID: <bogus-message-id@example.com>
 From: author@example.com
 Date: Sat, 12 Jun 2010 15:53:58 +0200
 Subject: subject goes here
@@ -1563,7 +1563,7 @@ test_expect_success $PREREQ '--8bit-encoding overrides sendemail.8bitEncoding' '
 test_expect_success $PREREQ 'setup expect' '
 	cat >email-using-8bit <<-\EOF
 	From fe6ecc66ece37198fe5db91fa2fc41d9f4fe5cc4 Mon Sep 17 00:00:00 2001
-	Message-Id: <bogus-message-id@example.com>
+	Message-ID: <bogus-message-id@example.com>
 	From: author@example.com
 	Date: Sat, 12 Jun 2010 15:53:58 +0200
 	Subject: Dieser Betreff enthält auch einen Umlaut!
@@ -1592,7 +1592,7 @@ test_expect_success $PREREQ '--8bit-encoding also treats subject' '
 test_expect_success $PREREQ 'setup expect' '
 	cat >email-using-8bit <<-\EOF
 	From fe6ecc66ece37198fe5db91fa2fc41d9f4fe5cc4 Mon Sep 17 00:00:00 2001
-	Message-Id: <bogus-message-id@example.com>
+	Message-ID: <bogus-message-id@example.com>
 	From: A U Thor <author@example.com>
 	Date: Sat, 12 Jun 2010 15:53:58 +0200
 	Content-Type: text/plain; charset=UTF-8
@@ -1673,7 +1673,7 @@ test_expect_success $PREREQ '8-bit and sendemail.transferencoding=base64' '
 test_expect_success $PREREQ 'setup expect' '
 	cat >email-using-qp <<-\EOF
 	From fe6ecc66ece37198fe5db91fa2fc41d9f4fe5cc4 Mon Sep 17 00:00:00 2001
-	Message-Id: <bogus-message-id@example.com>
+	Message-ID: <bogus-message-id@example.com>
 	From: A U Thor <author@example.com>
 	Date: Sat, 12 Jun 2010 15:53:58 +0200
 	MIME-Version: 1.0
@@ -1699,7 +1699,7 @@ test_expect_success $PREREQ 'convert from quoted-printable to base64' '
 test_expect_success $PREREQ 'setup expect' "
 tr -d '\\015' | tr '%' '\\015' >email-using-crlf <<EOF
 From fe6ecc66ece37198fe5db91fa2fc41d9f4fe5cc4 Mon Sep 17 00:00:00 2001
-Message-Id: <bogus-message-id@example.com>
+Message-ID: <bogus-message-id@example.com>
 From: A U Thor <author@example.com>
 Date: Sat, 12 Jun 2010 15:53:58 +0200
 Content-Type: text/plain; charset=UTF-8
Eric Wong· Nov 24, 2021, 06:12 UTC · re: Junio C Hamano · lore
Junio C Hamano <gitster@pobox.com> wrote:
Show 10 quoted lines
> Eric Wong <e@80x24.org> writes:
> 
> > git send-email's capitalization does annoy me and I've looked
> > into changing it; but there's a bunch of tests and probably
> > dependent code that also need to be updated...
> 
> It does annoy me, too, and I do not mind if it gets "fixed", but I
> do not know if the cost for vetting a bulk update like that is worth
> it.  There is another one outside send-email in log-tree.c that is
> responsible for output from format-patch.

I support updating the documentation in git, first; then perhaps making tests case-insensitive (which could be a complex change...).

Unfortunately, changing the send-email + log-tree.c code would break existing users of the applypatch-msg hook sample in linux/Documentation/maintainer/configure-git.rst which has been case-sensitive for around for 2 years: https://lore.kernel.org/r/20191118223019.81708-1-linus.walleij@linaro.org

:<
Ævar Arnfjörð Bjarmason· Nov 26, 2021, 12:49 UTC · re: Junio C Hamano · lore
On Tue, Nov 23 2021, Junio C Hamano wrote:
Show 19 quoted lines
> Eric Wong <e@80x24.org> writes:
>
>> git send-email's capitalization does annoy me and I've looked
>> into changing it; but there's a bunch of tests and probably
>> dependent code that also need to be updated...
> [...]
> diff --git i/git-send-email.perl w/git-send-email.perl
> index 5262d88ee3..a61134c7d3 100755
> --- i/git-send-email.perl
> +++ w/git-send-email.perl
> @@ -1494,7 +1494,7 @@ sub send_message {
>  To: $to${ccline}
>  Subject: $subject
>  Date: $date
> -Message-Id: $message_id
> +Message-ID: $message_id
>  ";
>  	if ($use_xmailer) {
>  		$header .= "X-Mailer: git-send-email $gitversion\n";

Perhaps one way to split this & make it more readable is to split this, i.e. the mesage-id's send-email itself generates & tests, usually it passes along format-patch's.

Show 9 quoted lines
> @@ -1789,7 +1789,7 @@ sub process_file {
>  				$has_mime_version = 1;
>  				push @xh, $_;
>  			}
> -			elsif (/^Message-Id: (.*)/i) {
> +			elsif (/^Message-ID: (.*)/i) {
>  				$message_id = $1;
>  			}
>  			elsif (/^Content-Transfer-Encoding: (.*)/i) {

Not strictly needed due to the /i, maybe splitting out cosmetic changes would be better?

I also notice we have various hits for "git grep message-id", including regex checks you didn't update here.

Ævar Arnfjörð Bjarmason· Nov 24, 2021, 02:08 UTC · re: Eric Wong · lore
On Tue, Nov 23 2021, Eric Wong wrote:
Show 22 quoted lines
> Thorsten Leemhuis <linux@leemhuis.info> wrote:
>> diff --git a/Documentation/maintainer/configure-git.rst b/Documentation/maintainer/configure-git.rst
>> index 80ae5030a590..8429d45d661c 100644
>> --- a/Documentation/maintainer/configure-git.rst
>> +++ b/Documentation/maintainer/configure-git.rst
>
> <snip>, +cc git@vger
>
>> @@ -56,7 +56,7 @@ by adding the following hook into your git:
>>  	$ cat >.git/hooks/applypatch-msg <<'EOF'
>>  	#!/bin/sh
>>  	. git-sh-setup
>> -	perl -pi -e 's|^Message-Id:\s*<?([^>]+)>?$|Link: https://lore.kernel.org/r/$1|g;' "$1"
>> +	perl -pi -e 's|^Message-Id:\s*<?([^>]+)>?$|Reviewed: https://lore.kernel.org/r/$1|g;' "$1"
>
> Side note: that regexp should match "Message-ID" case-insensitively.
> git send-email is an outlier in its capitalization of "Message-Id",
> most RFCs capitalize it "Message-ID", as do common MUAs.
>
> git send-email's capitalization does annoy me and I've looked
> into changing it; but there's a bunch of tests and probably
> dependent code that also need to be updated...

"git format-patch" does it without send-email, but I see that send-email will then parse its output, and would turn any capitalization into the "Message-Id" form again.

We could probably just have it preserve whatever capitalization it finds if there's an existing header, we wouldn't fix anything, but we'd move the blame around a bit :)

Thorsten Leemhuis· Nov 26, 2021, 07:29 UTC · re: Eric Wong · lore

Ccing Linus Walleij, who added this, and Kees, who apparently came up with this originally.

On 23.11.21 19:52, Eric Wong wrote:
Show 18 quoted lines
> Thorsten Leemhuis <linux@leemhuis.info> wrote:
>> diff --git a/Documentation/maintainer/configure-git.rst b/Documentation/maintainer/configure-git.rst
>> index 80ae5030a590..8429d45d661c 100644
>> --- a/Documentation/maintainer/configure-git.rst
>> +++ b/Documentation/maintainer/configure-git.rst
> 
> <snip>, +cc git@vger
> 
>> @@ -56,7 +56,7 @@ by adding the following hook into your git:
>>  	$ cat >.git/hooks/applypatch-msg <<'EOF'
>>  	#!/bin/sh
>>  	. git-sh-setup
>> -	perl -pi -e 's|^Message-Id:\s*<?([^>]+)>?$|Link: https://lore.kernel.org/r/$1|g;' "$1"
>> +	perl -pi -e 's|^Message-Id:\s*<?([^>]+)>?$|Reviewed: https://lore.kernel.org/r/$1|g;' "$1"
> 
> Side note: that regexp should match "Message-ID" case-insensitively.
> git send-email is an outlier in its capitalization of "Message-Id",
> most RFCs capitalize it "Message-ID", as do common MUAs.
Argh :-/

It's still totally unclear if that or a similar patch will be accepted. And even if it is: the "don't do two different things in one commit" rule might not be that strict enforced when it comes to the Linux kernel's docs, but changing this regexp as part of another patch crosses the line.

IOW: we afaics need a separate patch to make the regexp
case-insensitively. Eric, do you want to submit one, as you brought it
up? Or are there any other volunteers?
Ciao, Thorsten
Eric Wong· Nov 26, 2021, 17:11 UTC · re: Thorsten Leemhuis · lore
Thorsten Leemhuis <linux@leemhuis.info> wrote:
Show 34 quoted lines
> Ccing Linus Walleij, who added this, and Kees, who apparently came up
> with this originally.
> 
> On 23.11.21 19:52, Eric Wong wrote:
> > Thorsten Leemhuis <linux@leemhuis.info> wrote:
> >> diff --git a/Documentation/maintainer/configure-git.rst b/Documentation/maintainer/configure-git.rst
> >> index 80ae5030a590..8429d45d661c 100644
> >> --- a/Documentation/maintainer/configure-git.rst
> >> +++ b/Documentation/maintainer/configure-git.rst
> > 
> > <snip>, +cc git@vger
> > 
> >> @@ -56,7 +56,7 @@ by adding the following hook into your git:
> >>  	$ cat >.git/hooks/applypatch-msg <<'EOF'
> >>  	#!/bin/sh
> >>  	. git-sh-setup
> >> -	perl -pi -e 's|^Message-Id:\s*<?([^>]+)>?$|Link: https://lore.kernel.org/r/$1|g;' "$1"
> >> +	perl -pi -e 's|^Message-Id:\s*<?([^>]+)>?$|Reviewed: https://lore.kernel.org/r/$1|g;' "$1"
> > 
> > Side note: that regexp should match "Message-ID" case-insensitively.
> > git send-email is an outlier in its capitalization of "Message-Id",
> > most RFCs capitalize it "Message-ID", as do common MUAs.
> 
> Argh :-/
> 
> It's still totally unclear if that or a similar patch will be accepted.
> And even if it is: the "don't do two different things in one commit"
> rule might not be that strict enforced when it comes to the Linux
> kernel's docs, but changing this regexp as part of another patch crosses
> the line.
> 
> IOW: we afaics need a separate patch to make the regexp
> case-insensitively. Eric, do you want to submit one, as you brought it
> up? Or are there any other volunteers?

I suggest you turn this into a 2 patch series to avoid conflicts for a trivial change. I don't even have a kernel worktree handy at the moment (ENOSPC :x)

Thorsten Leemhuis· Nov 27, 2021, 19:32 UTC · re: Eric Wong · lore
On 26.11.21 18:11, Eric Wong wrote:
Show 39 quoted lines
> Thorsten Leemhuis <linux@leemhuis.info> wrote:
>> Ccing Linus Walleij, who added this, and Kees, who apparently came up
>> with this originally.
>>
>> On 23.11.21 19:52, Eric Wong wrote:
>>> Thorsten Leemhuis <linux@leemhuis.info> wrote:
>>>> diff --git a/Documentation/maintainer/configure-git.rst b/Documentation/maintainer/configure-git.rst
>>>> index 80ae5030a590..8429d45d661c 100644
>>>> --- a/Documentation/maintainer/configure-git.rst
>>>> +++ b/Documentation/maintainer/configure-git.rst
>>>
>>> <snip>, +cc git@vger
>>>
>>>> @@ -56,7 +56,7 @@ by adding the following hook into your git:
>>>>  	$ cat >.git/hooks/applypatch-msg <<'EOF'
>>>>  	#!/bin/sh
>>>>  	. git-sh-setup
>>>> -	perl -pi -e 's|^Message-Id:\s*<?([^>]+)>?$|Link: https://lore.kernel.org/r/$1|g;' "$1"
>>>> +	perl -pi -e 's|^Message-Id:\s*<?([^>]+)>?$|Reviewed: https://lore.kernel.org/r/$1|g;' "$1"
>>>
>>> Side note: that regexp should match "Message-ID" case-insensitively.
>>> git send-email is an outlier in its capitalization of "Message-Id",
>>> most RFCs capitalize it "Message-ID", as do common MUAs.
>>
>> Argh :-/
>>
>> It's still totally unclear if that or a similar patch will be accepted.
>> And even if it is: the "don't do two different things in one commit"
>> rule might not be that strict enforced when it comes to the Linux
>> kernel's docs, but changing this regexp as part of another patch crosses
>> the line.
>>
>> IOW: we afaics need a separate patch to make the regexp
>> case-insensitively. Eric, do you want to submit one, as you brought it
>> up? Or are there any other volunteers?
> 
> I suggest you turn this into a 2 patch series to avoid conflicts
> for a trivial change.  I don't even have a kernel worktree handy
> at the moment (ENOSPC :x)
:-D
Will do this in a couple of days, unless Linus or Kees speak up.

Just to be sure I'll do what you expect to be done: I assume you want to see it changed like this?

- perl -pi -e 's|^Message-Id:\s*<?([^>]+)>?$|Link: https://lore.kernel.org/r/$1|g;' "$1" + perl -pi -e 's|^Message-I[dD]:\s*<?([^>]+)>?$|Link: https://lore.kernel.org/r/$1|g;' "$1"

Or are there even more variants of Message-ID out there known that need to be taken into account?

Ciao, Thorsten
Eric Wong· Nov 27, 2021, 19:52 UTC · re: Thorsten Leemhuis · lore
Thorsten Leemhuis <linux@leemhuis.info> wrote:
Show 8 quoted lines
> Just to be sure I'll do what you expect to be done: I assume you want to see
> it changed like this?
> 
> -	perl -pi -e 's|^Message-Id:\s*<?([^>]+)>?$|Link: https://lore.kernel.org/r/$1|g;' "$1"
> +	perl -pi -e 's|^Message-I[dD]:\s*<?([^>]+)>?$|Link: https://lore.kernel.org/r/$1|g;' "$1"
> 
> Or are there even more variants of Message-ID out there known that
> need to be taken into account?

The entire match should be case-insensitive[1], so I'd add `i' at the end:

	perl -pi -e 's|^Message-ID:\s*<?([^>]+)>?$|Link: https://lore.kernel.org/r/$1|gi;' "$1"

Fwiw, every mail and HTTP/1.x header parser I've looked at works case-insensitively. Also, I'm not sure if `g' is needed, actually...

[1] https://datatracker.ietf.org/doc/html/rfc822#section-3.4.7
Junio C Hamano· Nov 27, 2021, 20:20 UTC · re: Eric Wong · lore
Eric Wong <e@80x24.org> writes:
Show 13 quoted lines
> Thorsten Leemhuis <linux@leemhuis.info> wrote:
>> Just to be sure I'll do what you expect to be done: I assume you want to see
>> it changed like this?
>> 
>> -	perl -pi -e 's|^Message-Id:\s*<?([^>]+)>?$|Link: https://lore.kernel.org/r/$1|g;' "$1"
> ...
> The entire match should be case-insensitive[1], so I'd add `i'
> at the end:
>
> 	perl -pi -e 's|^Message-ID:\s*<?([^>]+)>?$|Link: https://lore.kernel.org/r/$1|gi;' "$1"
>
> Fwiw, every mail and HTTP/1.x header parser I've looked at works
> case-insensitively.  Also, I'm not sure if `g' is needed, actually...

It is left anchored with "^" so it would be hard to match more than once on the same line ;-)

I agree that it is the right solution to make the whole thing case-insensitive by adding 'i' at the end.

FWIW, the RFC first says this:
    1.2.2. Syntactic notation
       This standard uses the Augmented Backus-Naur Form (ABNF) notation
       specified in [RFC2234] for the formal definitions of the syntax of
       messages.  Characters will be specified either by a decimal value
       (e.g., the value %d65 for uppercase A and %d97 for lowercase A) or by
       a case-insensitive literal value enclosed in quotation marks (e.g.,
       "A" for either uppercase or lowercase A).
and then goes on to define how message-id should look like.
    3.6.4. Identification fields
    message-id      =       "Message-ID:" msg-id CRLF

But if you go the "add /i at the end" route, you do not have to upcase "d" to "D" and that may reduce the patch noise (it only matters if the patch viewer highlights letter-by-letter changes for your recipients).

HTH
Jani Nikula· Nov 29, 2021, 12:03 UTC · re: Junio C Hamano · lore
On Sat, 27 Nov 2021, Junio C Hamano <gitster@pobox.com> wrote:
Show 44 quoted lines
> Eric Wong <e@80x24.org> writes:
>
>> Thorsten Leemhuis <linux@leemhuis.info> wrote:
>>> Just to be sure I'll do what you expect to be done: I assume you want to see
>>> it changed like this?
>>> 
>>> -	perl -pi -e 's|^Message-Id:\s*<?([^>]+)>?$|Link: https://lore.kernel.org/r/$1|g;' "$1"
>> ...
>> The entire match should be case-insensitive[1], so I'd add `i'
>> at the end:
>>
>> 	perl -pi -e 's|^Message-ID:\s*<?([^>]+)>?$|Link: https://lore.kernel.org/r/$1|gi;' "$1"
>>
>> Fwiw, every mail and HTTP/1.x header parser I've looked at works
>> case-insensitively.  Also, I'm not sure if `g' is needed, actually...
>
> It is left anchored with "^" so it would be hard to match more than
> once on the same line ;-)
>
> I agree that it is the right solution to make the whole thing
> case-insensitive by adding 'i' at the end.
>
> FWIW, the RFC first says this:
>
>     1.2.2. Syntactic notation
>
>        This standard uses the Augmented Backus-Naur Form (ABNF) notation
>        specified in [RFC2234] for the formal definitions of the syntax of
>        messages.  Characters will be specified either by a decimal value
>        (e.g., the value %d65 for uppercase A and %d97 for lowercase A) or by
>        a case-insensitive literal value enclosed in quotation marks (e.g.,
>        "A" for either uppercase or lowercase A).
>
> and then goes on to define how message-id should look like.
>
>     3.6.4. Identification fields
>
>     message-id      =       "Message-ID:" msg-id CRLF
>
>
> But if you go the "add /i at the end" route, you do not have to
> upcase "d" to "D" and that may reduce the patch noise (it only
> matters if the patch viewer highlights letter-by-letter changes for
> your recipients).

From the RFC nitpicking department, msg-id is allowed to contain CFWS (comments and folding white space) outside the angle brackets, which means you could have RFC compliant Message-ID header field:

Message-ID: 
  <message-id@example.com>
or
Message-ID: (comment) 
  <message-id@example.com>
or even worse, really.

The moral of the story is that you should always offload the header parsing to some tool or library designed to do that.

BR, Jani.

-- 
Jani Nikula, Intel Open Source Graphics Center
Junio C Hamano· Nov 29, 2021, 17:18 UTC · re: Jani Nikula · lore
Jani Nikula <jani.nikula@intel.com> writes:
> From the RFC nitpicking department, ...
>
> Message-ID: (comment) 
>   <message-id@example.com>
Thanks for a fun piece; the (comment) is quite interesting.

I wasn't having fun with RFC nitpicking, though. I was reacting to this part of the message I was responding to ...

>>> Fwiw, every mail and HTTP/1.x header parser I've looked at works
>>> case-insensitively.  Also, I'm not sure if `g' is needed, actually...

... to say that "works case-insensitively" may not just be empirically correct, but RFC backs him up, to Eric.

Jani Nikula· Nov 29, 2021, 19:18 UTC · re: Junio C Hamano · lore
On Mon, 29 Nov 2021, Junio C Hamano <gitster@pobox.com> wrote:
> I wasn't having fun with RFC nitpicking, though.
I didn't mean to imply you were, I was saying I was!

BR, Jani.

-- 
Jani Nikula, Intel Open Source Graphics Center
Eric Wong· Nov 29, 2021, 17:26 UTC · re: Jani Nikula · lore
Jani Nikula <jani.nikula@intel.com> wrote:
Show 16 quoted lines
> From the RFC nitpicking department, msg-id is allowed to contain CFWS
> (comments and folding white space) outside the angle brackets, which
> means you could have RFC compliant Message-ID header field:
> 
> Message-ID: 
>   <message-id@example.com>
> 
> or
> 
> Message-ID: (comment) 
>   <message-id@example.com>
> 
> or even worse, really.
> 
> The moral of the story is that you should always offload the header
> parsing to some tool or library designed to do that.

It's a bit much for common cases with git-send-email and reasonable MUAs, I think. I don't know if formail is commonly installed, nowadays...

Fwiw, the code running lore uses something like this:
	/^Message-ID:[ \t]*([^\n]*\r?\n # 1st line
			# continuation lines:
			(?:[^:\n]*?[ \t]+[^\n]*\r?\n)*)
			/ismx

I'm fine with this non-trivial regexp being included with GPL-2.0 code; but it could be too big for a one-liner *shrug*

... And <([^>]+)>/s to extract Message-IDs, but ISTR the code behind lore doesn't handle spaces inside <> properly, but I'm not sure if there's enough valid, non-spam messages with them...

Jani Nikula· Nov 29, 2021, 19:20 UTC · re: Eric Wong · lore
On Mon, 29 Nov 2021, Eric Wong <e@80x24.org> wrote:
Show 6 quoted lines
> Jani Nikula <jani.nikula@intel.com> wrote:
>> The moral of the story is that you should always offload the header
>> parsing to some tool or library designed to do that.
>
> It's a bit much for common cases with git-send-email and
> reasonable MUAs, I think.
I think you can have unreasonable MDAs in between, though!

BR, Jani.

-- 
Jani Nikula, Intel Open Source Graphics Center
Geert Uytterhoeven· Nov 30, 2021, 08:24 UTC · re: Eric Wong · lore
Hi Eric,
On Mon, Nov 29, 2021 at 11:29 PM Eric Wong <e@80x24.org> wrote:
> It's a bit much for common cases with git-send-email and
> reasonable MUAs, I think.  I don't know if formail is commonly
> installed, nowadays...

Of course ;-) You need it to run checkpatch on patch series obtained through "b4 am", before you apply them to your tree:

$ cat *mbx | formail -s scripts/checkpatch.pl
Gr{oetje,eeting}s,
                        Geert

-- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
Thorsten Leemhuis· Dec 8, 2021, 13:41 UTC · re: Geert Uytterhoeven · lore
Hi Eric!
On 30.11.21 09:24, Geert Uytterhoeven wrote:
> On Mon, Nov 29, 2021 at 11:29 PM Eric Wong <e@80x24.org> wrote:
>> It's a bit much for common cases with git-send-email and
>> reasonable MUAs, I think.  I don't know if formail is commonly
>> installed, nowadays...
Well, after your earlier suggestion I considered to go with this:

- perl -pi -e 's|^Message-Id:\s*<?([^>]+)>?$|Link: https://lore.kernel.org/r/$1|g;' "$1" + perl -pi -e 's|^Message-ID:\s*<?([^>]+)>?$|Link: https://lore.kernel.org/r/$1|i;' "$1"

But...
> Of course ;-) You need it to run checkpatch on patch series obtained
> through "b4 am", before you apply them to your tree:
> 
> $ cat *mbx | formail -s scripts/checkpatch.pl

...this made me wonder if formail would be the better solution. I came up with this:

formail -A "Link: https://lore.kernel.org/r/`formail -c -x Message-ID < "${1}" | sed 's!.*<\(.*\)>!\1!'`" < "${1}" | sponge "${1}"

Downsides: instead of perl it requires sed and sponge (part of
moreutils, which I guess not everyone has installed; but I tried to
avoid a big here document or moving files around).

Is that worth it? Or is there a way to realize this in a more elegant fashion with tools everyone has installed?

Ciao, Thorsten
Eric Wong· Dec 8, 2021, 17:02 UTC · re: Thorsten Leemhuis · lore
Thorsten Leemhuis <linux@leemhuis.info> wrote:
Show 29 quoted lines
> On 30.11.21 09:24, Geert Uytterhoeven wrote:
> > On Mon, Nov 29, 2021 at 11:29 PM Eric Wong <e@80x24.org> wrote:
> >> It's a bit much for common cases with git-send-email and
> >> reasonable MUAs, I think.  I don't know if formail is commonly
> >> installed, nowadays...
> 
> Well, after your earlier suggestion I considered to go with this:
> 
> -	perl -pi -e 's|^Message-Id:\s*<?([^>]+)>?$|Link:
> https://lore.kernel.org/r/$1|g;' "$1"
> +	perl -pi -e 's|^Message-ID:\s*<?([^>]+)>?$|Link:
> https://lore.kernel.org/r/$1|i;' "$1"
> 
> But...
> 
> > Of course ;-) You need it to run checkpatch on patch series obtained
> > through "b4 am", before you apply them to your tree:
> > 
> > $ cat *mbx | formail -s scripts/checkpatch.pl
> 
> ...this made me wonder if formail would be the better solution. I came
> up with this:
> 
> formail -A "Link: https://lore.kernel.org/r/`formail -c -x Message-ID <
> "${1}" | sed 's!.*<\(.*\)>!\1!'`" < "${1}" | sponge "${1}"
> 
> Downsides: instead of perl it requires sed and sponge (part of
> moreutils, which I guess not everyone has installed; but I tried to
> avoid a big here document or moving files around).

As Geert noted, formail is probably reasonable, but I certainly don't have moreutils across all the systems I'm using right now.

> Is that worth it? Or is there a way to realize this in a more elegant
> fashion with tools everyone has installed?

*shrug* Since newlines after ':' are a concern and it's (probably :P) safe to slurp entire contents of emails into memory nowadays; some minor tweaks to the original perl invocation should work:

* use `$/ = undef' to force Perl to operate on the entire input at once
* use `m' RE modifier to ensure `^' and `$' still match SOL/EOL
  ($/ is only the input record separator, it doesn't change
   Perl's definition of "lines" for `^' and `$')
perl -i -p -e 'BEGIN{$/=undef};s|^Message-ID:\s*<?([^>]+)>?$|Link:
 https://lore.kernel.org/r/$1|im;'
Steven Rostedt· Nov 29, 2021, 17:10 UTC · re: Jani Nikula · lore

On Mon, 29 Nov 2021 14:03:09 +0200 Jani Nikula <jani.nikula@intel.com> wrote:

Show 6 quoted lines
> >From the RFC nitpicking department, msg-id is allowed to contain CFWS  
> (comments and folding white space) outside the angle brackets, which
> means you could have RFC compliant Message-ID header field:
> 
> Message-ID: 
>   <message-id@example.com>

My scripts have already been hit by this. (I've been lazy and not fixed it, but instead, just edit the file that it is parsing manually, to be on one line :-p)

-- Steve

← back to recent threads