Based on multiple conversations, most recently on the ksummit mailing
list [1], add some best practices for using the Link trailer, such as:
- how to use markdown-like bracketed numbers in the commit message to
indicate the corresponding link
- when to use lore.kernel.org vs patch.msgid.link domains
Cc: ksummit@lists.linux.dev
Link: https://lore.kernel.org/20240617-arboreal-industrious-hedgehog-5b84ae@meerkat # [1]
Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
---
Documentation/process/maintainer-tip.rst | 30 ++++++++++++++++++++++--------
1 file changed, 22 insertions(+), 8 deletions(-)
diff --git a/Documentation/process/maintainer-tip.rst b/Documentation/process/maintainer-tip.rst
index 64739968afa6..ba312345d030 100644
--- a/Documentation/process/maintainer-tip.rst
+++ b/Documentation/process/maintainer-tip.rst
@@ -372,17 +372,31 @@ following tag ordering scheme:
- Link: ``https://link/to/information``
- For referring to an email on LKML or other kernel mailing lists,
- please use the lore.kernel.org redirector URL::
+ For referring to an email posted to the kernel mailing lists, please
+ use the lore.kernel.org redirector URL::
- https://lore.kernel.org/r/email-message@id
+ Link: https://lore.kernel.org/email-message-id@here
- The kernel.org redirector is considered a stable URL, unlike other email
- archives.
+ This URL should be used when referring to relevant mailing list
+ topics, related patch sets, or other notable discussion threads.
+ A convenient way to associate ``Link:`` trailers with the commit
+ message is to use markdown-like bracketed notation, for example::
- Maintainers will add a Link tag referencing the email of the patch
- submission when they apply a patch to the tip tree. This tag is useful
- for later reference and is also used for commit notifications.
+ A similar approach was attempted before as part of a different
+ effort [1], but the initial implementation caused too many
+ regressions [2], so it was backed out and reimplemented.
+
+ Link: https://lore.kernel.org/some-msgid@here # [1]
+ Link: https://bugzilla.example.org/bug/12345 # [2]
+
+ You can also use ``Link:`` trailers to indicate the origin of the
+ patch when applying it to your git tree. In that case, please use the
+ dedicated ``patch.msgid.link`` domain instead of ``lore.kernel.org``.
+ This practice makes it possible for automated tooling to identify
+ which link to use to retrieve the original patch submission. For
+ example::
+
+ Link: https://patch.msgid.link/patch-source-message-id@here
Please do not use combined tags, e.g. ``Reported-and-tested-by``, as
they just complicate automated extraction of tags.
--
2.45.2
Konstantin Ryabitsev <konstantin@linuxfoundation.org> writes:
> Based on multiple conversations, most recently on the ksummit mailing
> list [1], add some best practices for using the Link trailer, such as:
>
> - how to use markdown-like bracketed numbers in the commit message to
> indicate the corresponding link
> - when to use lore.kernel.org vs patch.msgid.link domains
>
> Cc: ksummit@lists.linux.dev
> Link: https://lore.kernel.org/20240617-arboreal-industrious-hedgehog-5b84ae@meerkat # [1]
> Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
> ---
> Documentation/process/maintainer-tip.rst | 30 ++++++++++++++++++++++--------
> 1 file changed, 22 insertions(+), 8 deletions(-)
>
> diff --git a/Documentation/process/maintainer-tip.rst b/Documentation/process/maintainer-tip.rst
> index 64739968afa6..ba312345d030 100644
> --- a/Documentation/process/maintainer-tip.rst
> +++ b/Documentation/process/maintainer-tip.rst
> @@ -372,17 +372,31 @@ following tag ordering scheme:
>
> - Link: ``https://link/to/information``
>
> - For referring to an email on LKML or other kernel mailing lists,
> - please use the lore.kernel.org redirector URL::
> + For referring to an email posted to the kernel mailing lists, please
> + use the lore.kernel.org redirector URL::
>
> - https://lore.kernel.org/r/email-message@id
> + Link: https://lore.kernel.org/email-message-id@here
>
> - The kernel.org redirector is considered a stable URL, unlike other email
> - archives.
> + This URL should be used when referring to relevant mailing list
> + topics, related patch sets, or other notable discussion threads.
> + A convenient way to associate ``Link:`` trailers with the commit
> + message is to use markdown-like bracketed notation, for example::
>
> - Maintainers will add a Link tag referencing the email of the patch
> - submission when they apply a patch to the tip tree. This tag is useful
> - for later reference and is also used for commit notifications.
> + A similar approach was attempted before as part of a different
> + effort [1], but the initial implementation caused too many
> + regressions [2], so it was backed out and reimplemented.
> +
> + Link: https://lore.kernel.org/some-msgid@here # [1]
> + Link: https://bugzilla.example.org/bug/12345 # [2]
Does it actually make sense to use the Link: prefix here? These sort of
links are part of the prose, they're not something a script can download
and make any sense of.
I see some existing usage of the above style, but equally there's lots
of examples of footnote-style links without the Link: tag, eg:
commit 40b561e501768ef24673d0e1d731a7b9b1bc6709
Merge: d9f843fbd45e 31611cc8faa0
Author: Arnd Bergmann <arnd@arndb.de>
Date: Mon Apr 29 22:29:44 2024 +0200
Merge tag 'tee-ts-for-v6.10' of https://git.linaro.org/people/jens.wiklander/linux-tee into soc/drivers
TEE driver for Trusted Services
This introduces a TEE driver for Trusted Services [1].
Trusted Services is a TrustedFirmware.org project that provides a
framework for developing and deploying device Root of Trust services in
FF-A [2] Secure Partitions. The project hosts the reference
implementation of Arm Platform Security Architecture [3] for Arm
A-profile devices.
...
[1] https://www.trustedfirmware.org/projects/trusted-services/
[2] https://developer.arm.com/documentation/den0077/
[3] https://www.arm.com/architecture/security-features/platform-security
The above style is standard markdown style for reference links (or as
standard as markdown gets).
cheers
On June 21, 2024 9:27:34 PM PDT, Michael Ellerman <mpe@ellerman.id.au> wrote: >Konstantin Ryabitsev <konstantin@linuxfoundation.org> writes: >> Based on multiple conversations, most recently on the ksummit mailing >> list [1], add some best practices for using the Link trailer, such as: >> >> - how to use markdown-like bracketed numbers in the commit message to >> indicate the corresponding link >> - when to use lore.kernel.org vs patch.msgid.link domains >> >> Cc: ksummit@lists.linux.dev >> Link: https://lore.kernel.org/20240617-arboreal-industrious-hedgehog-5b84ae@meerkat # [1] >> Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org> >> --- >> Documentation/process/maintainer-tip.rst | 30 ++++++++++++++++++++++-------- >> 1 file changed, 22 insertions(+), 8 deletions(-) >> >> diff --git a/Documentation/process/maintainer-tip.rst b/Documentation/process/maintainer-tip.rst >> index 64739968afa6..ba312345d030 100644 >> --- a/Documentation/process/maintainer-tip.rst >> +++ b/Documentation/process/maintainer-tip.rst >> @@ -372,17 +372,31 @@ following tag ordering scheme: >> >> - Link: ``https://link/to/information`` >> >> - For referring to an email on LKML or other kernel mailing lists, >> - please use the lore.kernel.org redirector URL:: >> + For referring to an email posted to the kernel mailing lists, please >> + use the lore.kernel.org redirector URL:: >> >> - https://lore.kernel.org/r/email-message@id >> + Link: https://lore.kernel.org/email-message-id@here >> >> - The kernel.org redirector is considered a stable URL, unlike other email >> - archives. >> + This URL should be used when referring to relevant mailing list >> + topics, related patch sets, or other notable discussion threads. >> + A convenient way to associate ``Link:`` trailers with the commit >> + message is to use markdown-like bracketed notation, for example:: >> >> - Maintainers will add a Link tag referencing the email of the patch >> - submission when they apply a patch to the tip tree. This tag is useful >> - for later reference and is also used for commit notifications. >> + A similar approach was attempted before as part of a different >> + effort [1], but the initial implementation caused too many >> + regressions [2], so it was backed out and reimplemented. >> + >> + Link: https://lore.kernel.org/some-msgid@here # [1] >> + Link: https://bugzilla.example.org/bug/12345 # [2] > >Does it actually make sense to use the Link: prefix here? These sort of >links are part of the prose, they're not something a script can download >and make any sense of. > >I see some existing usage of the above style, but equally there's lots >of examples of footnote-style links without the Link: tag, eg: I moved from that to using Link: because checkpatch would complain about my long (URL) lines unless it had a Link tag :P >commit 40b561e501768ef24673d0e1d731a7b9b1bc6709 >Merge: d9f843fbd45e 31611cc8faa0 >Author: Arnd Bergmann <arnd@arndb.de> >Date: Mon Apr 29 22:29:44 2024 +0200 > > Merge tag 'tee-ts-for-v6.10' of https://git.linaro.org/people/jens.wiklander/linux-tee into soc/drivers > > TEE driver for Trusted Services > > This introduces a TEE driver for Trusted Services [1]. > > Trusted Services is a TrustedFirmware.org project that provides a > framework for developing and deploying device Root of Trust services in > FF-A [2] Secure Partitions. The project hosts the reference > implementation of Arm Platform Security Architecture [3] for Arm > A-profile devices. > > ... > > [1] https://www.trustedfirmware.org/projects/trusted-services/ > [2] https://developer.arm.com/documentation/den0077/ > [3] https://www.arm.com/architecture/security-features/platform-security > > >The above style is standard markdown style for reference links (or as >standard as markdown gets). It's a good point. If we're formalizing this, why not literally use markdown instead? (I guess the answer is that out-of-line links/footnotes isn't standardized.) Playing devil's advocate, outside of the kernel, these are the two most common styles I've seen: Foo[1] ... [1]: https://.... and Bar[^1] ... [^1] https://... Personally, I only want to have a single official way to do this, and don't care much what it is. I have a minor preference for what you've described: Baz[1] ... [1] https://... -Kees -- Kees Cook
On 6/22/24 7:40 AM, Kees Cook wrote: >> I see some existing usage of the above style, but equally there's lots >> of examples of footnote-style links without the Link: tag, eg: > I moved from that to using Link: because checkpatch would complain about my long (URL) lines unless it had a Link tag :P We know that checkpatch isn't perfect. It's safe to ignore such complaints. -- ~Randy
On Wed, Jun 19, 2024 at 02:24:07PM -0400, Konstantin Ryabitsev wrote: > + This URL should be used when referring to relevant mailing list > + topics, related patch sets, or other notable discussion threads. > + A convenient way to associate ``Link:`` trailers with the commit > + message is to use markdown-like bracketed notation, for example:: > ... > + Link: https://lore.kernel.org/some-msgid@here # [1] > + Link: https://bugzilla.example.org/bug/12345 # [2] Why are we adding the extra "# " characters? The vast majority of existing Link tags don't do this: $ git log --grep Link: | grep 'Link:.*\[' > links.txt $ wc -l links.txt 1687 links.txt # Link: URL... [1] $ grep 'Link: .*[^#] \[' links.txt | wc -l 1546 # Link: URL... # [1] $ grep 'Link: .* # \[' links.txt | wc -l 83 # Link: [1] URL... $ grep 'Link: \[' links.txt | wc -l 44 # Link: URL... [#1] $ grep 'Link: .*\[#' links.txt | wc -l 12 -- Kees Cook
On Fri, Jun 21, 2024 at 02:07:44PM GMT, Kees Cook wrote:
> On Wed, Jun 19, 2024 at 02:24:07PM -0400, Konstantin Ryabitsev wrote:
> > + This URL should be used when referring to relevant mailing list
> > + topics, related patch sets, or other notable discussion threads.
> > + A convenient way to associate ``Link:`` trailers with the commit
> > + message is to use markdown-like bracketed notation, for example::
> > ...
> > + Link: https://lore.kernel.org/some-msgid@here # [1]
> > + Link: https://bugzilla.example.org/bug/12345 # [2]
>
> Why are we adding the extra "# " characters? The vast majority of
> existing Link tags don't do this:
That's just convention. In general, the hash separates the trailer from the
comment:
Trailer-name: actual-trailer-body # comment
-K
Konstantin Ryabitsev <konstantin@linuxfoundation.org> writes: > On Fri, Jun 21, 2024 at 02:07:44PM GMT, Kees Cook wrote: >> On Wed, Jun 19, 2024 at 02:24:07PM -0400, Konstantin Ryabitsev wrote: >> > + This URL should be used when referring to relevant mailing list >> > + topics, related patch sets, or other notable discussion threads. >> > + A convenient way to associate ``Link:`` trailers with the commit >> > + message is to use markdown-like bracketed notation, for example:: >> > ... >> > + Link: https://lore.kernel.org/some-msgid@here # [1] >> > + Link: https://bugzilla.example.org/bug/12345 # [2] >> >> Why are we adding the extra "# " characters? The vast majority of >> existing Link tags don't do this: > > That's just convention. In general, the hash separates the trailer from the > comment: > > Trailer-name: actual-trailer-body # comment > Did we ever come to a conclusion on this? This one character seems to be the main source of disagreement in this series, I'm wondering if I should just apply it and let the painting continue thereafter...? jon
On 6/26/24 4:13 PM, Jonathan Corbet wrote: > Konstantin Ryabitsev <konstantin@linuxfoundation.org> writes: > >> On Fri, Jun 21, 2024 at 02:07:44PM GMT, Kees Cook wrote: >>> On Wed, Jun 19, 2024 at 02:24:07PM -0400, Konstantin Ryabitsev wrote: >>>> + This URL should be used when referring to relevant mailing list >>>> + topics, related patch sets, or other notable discussion threads. >>>> + A convenient way to associate ``Link:`` trailers with the commit >>>> + message is to use markdown-like bracketed notation, for example:: >>>> ... >>>> + Link: https://lore.kernel.org/some-msgid@here # [1] >>>> + Link: https://bugzilla.example.org/bug/12345 # [2] >>> >>> Why are we adding the extra "# " characters? The vast majority of >>> existing Link tags don't do this: >> >> That's just convention. In general, the hash separates the trailer from the >> comment: >> >> Trailer-name: actual-trailer-body # comment >> > > Did we ever come to a conclusion on this? This one character seems to > be the main source of disagreement in this series, I'm wondering if I > should just apply it and let the painting continue thereafter...? We have used '#' for ages for adding comments to by: tags. I'm surprised that it's not documented. -- ~Randy
On 27.06.24 01:17, Randy Dunlap wrote:
> On 6/26/24 4:13 PM, Jonathan Corbet wrote:
>> Konstantin Ryabitsev <konstantin@linuxfoundation.org> writes:
>>> On Fri, Jun 21, 2024 at 02:07:44PM GMT, Kees Cook wrote:
>>>> On Wed, Jun 19, 2024 at 02:24:07PM -0400, Konstantin Ryabitsev wrote:
>>>>> + This URL should be used when referring to relevant mailing list
>>>>> + topics, related patch sets, or other notable discussion threads.
>>>>> + A convenient way to associate ``Link:`` trailers with the commit
>>>>> + message is to use markdown-like bracketed notation, for example::
>>>>> ...
>>>>> + Link: https://lore.kernel.org/some-msgid@here # [1]
>>>>> + Link: https://bugzilla.example.org/bug/12345 # [2]
>>>>
>>>> Why are we adding the extra "# " characters? The vast majority of
>>>> existing Link tags don't do this:
>>>
>>> That's just convention. In general, the hash separates the trailer from the
>>> comment:
>>>
>>> Trailer-name: actual-trailer-body # comment
>>
>> Did we ever come to a conclusion on this? This one character seems to
>> be the main source of disagreement in this series, I'm wondering if I
>> should just apply it and let the painting continue thereafter...?
>
> We have used '#' for ages for adding comments to by: tags.
> I'm surprised that it's not documented.
I thought it was documented, but either I was wrong or can't find it.
But I found process/5.Posting.rst, which provides this example:
Link: https://example.com/somewhere.html optional-other-stuff
So no "# " there. So to avoid inconsistencies I guess this should not be
applied, unless that document is changed as well.
Ciao, Thorsten
On Thu, Jun 27, 2024 at 05:51:47AM GMT, Thorsten Leemhuis wrote:
> I thought it was documented, but either I was wrong or can't find it.
> But I found process/5.Posting.rst, which provides this example:
>
> Link: https://example.com/somewhere.html optional-other-stuff
>
> So no "# " there. So to avoid inconsistencies I guess this should not be
> applied, unless that document is changed as well.
This is inconsistent with every other trailer that includes comments.
Currently, there are two mechanisms to provide comments with trailers:
1:
| Trailer-name: trailer-content # trailer-comment
2:
| Trailer-name: trailer-content
| [trailer-comment]
For the sake of consistency, all trailers, including Link, should use one of
these two mechanisms for "optional-other-stuff".
-K
On Fri, 28 Jun 2024 10:52:37 -0400
Konstantin Ryabitsev <konstantin@linuxfoundation.org> wrote:
> On Thu, Jun 27, 2024 at 05:51:47AM GMT, Thorsten Leemhuis wrote:
> > I thought it was documented, but either I was wrong or can't find it.
> > But I found process/5.Posting.rst, which provides this example:
> >
> > Link: https://example.com/somewhere.html optional-other-stuff
> >
> > So no "# " there. So to avoid inconsistencies I guess this should not be
> > applied, unless that document is changed as well.
>
> This is inconsistent with every other trailer that includes comments.
> Currently, there are two mechanisms to provide comments with trailers:
>
> 1:
>
> | Trailer-name: trailer-content # trailer-comment
>
> 2:
>
> | Trailer-name: trailer-content
> | [trailer-comment]
Where do you see that?
Whenever I do the second one, it has nothing to do with the tag, but
what I have done to the patch/commit.
Signed-off-by: Random Developer <rdevelop@company.com>
[ Fixed formatting ]
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
That is, if I do any modification of the original submission, I
document it this way.
-- Steve
>
> For the sake of consistency, all trailers, including Link, should use one of
> these two mechanisms for "optional-other-stuff".
>
> -K
On 6/26/24 8:51 PM, Thorsten Leemhuis wrote: > On 27.06.24 01:17, Randy Dunlap wrote: >> On 6/26/24 4:13 PM, Jonathan Corbet wrote: >>> Konstantin Ryabitsev <konstantin@linuxfoundation.org> writes: >>>> On Fri, Jun 21, 2024 at 02:07:44PM GMT, Kees Cook wrote: >>>>> On Wed, Jun 19, 2024 at 02:24:07PM -0400, Konstantin Ryabitsev wrote: >>>>>> + This URL should be used when referring to relevant mailing list >>>>>> + topics, related patch sets, or other notable discussion threads. >>>>>> + A convenient way to associate ``Link:`` trailers with the commit >>>>>> + message is to use markdown-like bracketed notation, for example:: >>>>>> ... >>>>>> + Link: https://lore.kernel.org/some-msgid@here # [1] >>>>>> + Link: https://bugzilla.example.org/bug/12345 # [2] >>>>> >>>>> Why are we adding the extra "# " characters? The vast majority of >>>>> existing Link tags don't do this: >>>> >>>> That's just convention. In general, the hash separates the trailer from the >>>> comment: >>>> >>>> Trailer-name: actual-trailer-body # comment >>> >>> Did we ever come to a conclusion on this? This one character seems to >>> be the main source of disagreement in this series, I'm wondering if I >>> should just apply it and let the painting continue thereafter...? >> >> We have used '#' for ages for adding comments to by: tags. >> I'm surprised that it's not documented. > > I thought it was documented, but either I was wrong or can't find it. > But I found process/5.Posting.rst, which provides this example: > > Link: https://example.com/somewhere.html optional-other-stuff > > So no "# " there. So to avoid inconsistencies I guess this should not be > applied, unless that document is changed as well. In my use cases, other-optional-stuff begins with '#'. -- ~Randy
On Wed, Jun 19, 2024 at 02:24:07PM -0400, Konstantin Ryabitsev wrote:
> Based on multiple conversations, most recently on the ksummit mailing
> list [1], add some best practices for using the Link trailer, such as:
>
> - how to use markdown-like bracketed numbers in the commit message to
> indicate the corresponding link
> - when to use lore.kernel.org vs patch.msgid.link domains
>
> Cc: ksummit@lists.linux.dev
> Link: https://lore.kernel.org/20240617-arboreal-industrious-hedgehog-5b84ae@meerkat # [1]
> Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
> ---
> Documentation/process/maintainer-tip.rst | 30 ++++++++++++++++++++++--------
> 1 file changed, 22 insertions(+), 8 deletions(-)
>
> diff --git a/Documentation/process/maintainer-tip.rst b/Documentation/process/maintainer-tip.rst
> index 64739968afa6..ba312345d030 100644
> --- a/Documentation/process/maintainer-tip.rst
> +++ b/Documentation/process/maintainer-tip.rst
> @@ -372,17 +372,31 @@ following tag ordering scheme:
>
> - Link: ``https://link/to/information``
>
> - For referring to an email on LKML or other kernel mailing lists,
> - please use the lore.kernel.org redirector URL::
> + For referring to an email posted to the kernel mailing lists, please
> + use the lore.kernel.org redirector URL::
>
> - https://lore.kernel.org/r/email-message@id
> + Link: https://lore.kernel.org/email-message-id@here
>
> - The kernel.org redirector is considered a stable URL, unlike other email
> - archives.
> + This URL should be used when referring to relevant mailing list
> + topics, related patch sets, or other notable discussion threads.
> + A convenient way to associate ``Link:`` trailers with the commit
> + message is to use markdown-like bracketed notation, for example::
>
> - Maintainers will add a Link tag referencing the email of the patch
> - submission when they apply a patch to the tip tree. This tag is useful
> - for later reference and is also used for commit notifications.
> + A similar approach was attempted before as part of a different
> + effort [1], but the initial implementation caused too many
> + regressions [2], so it was backed out and reimplemented.
> +
> + Link: https://lore.kernel.org/some-msgid@here # [1]
> + Link: https://bugzilla.example.org/bug/12345 # [2]
> +
> + You can also use ``Link:`` trailers to indicate the origin of the
> + patch when applying it to your git tree. In that case, please use the
> + dedicated ``patch.msgid.link`` domain instead of ``lore.kernel.org``.
> + This practice makes it possible for automated tooling to identify
> + which link to use to retrieve the original patch submission. For
> + example::
> +
> + Link: https://patch.msgid.link/patch-source-message-id@here
>
> Please do not use combined tags, e.g. ``Reported-and-tested-by``, as
> they just complicate automated extraction of tags.
Could you please add a hint on configuring git am to create these?
I think something like this in .git/hooks/applypatch-msg will work:
. git-sh-setup
perl -pi -e 's|^Message-Id:\s*<?([^>]+)>?$|Link: https://patch.msgid.link/$1|g;' "$1"
test -x "$GIT_DIR/hooks/commit-msg" &&
exec "$GIT_DIR/hooks/commit-msg" ${1+"$@"}
:
but I didn't actually try.
Thanks!
> --
> 2.45.2
>
© 2016 - 2025 Red Hat, Inc.