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

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

From
JNJani Nikula <jani.nikula@intel.com>
Date
Nov 29, 2021, 12:03 UTC
Message-ID
<87mtlnjhj6.fsf@intel.com>
In-Reply-To
<xmqqtufx5p19.fsf@gitster.g>
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
Previous: Junio C HamanoNext: Junio C Hamano
Message 11 of 19 in “Re: [RFC PATCH v1 1/1] docs: add the new commit-msg tags 'Reported:' and 'Reviewed:'”
  1. Eric WongNov 23, 2021
  2. Junio C HamanoNov 24, 2021
  3. Eric WongNov 24, 2021
  4. Ævar Arnfjörð BjarmasonNov 26, 2021
  5. Ævar Arnfjörð BjarmasonNov 24, 2021
  6. Thorsten LeemhuisNov 26, 2021
  7. Eric WongNov 26, 2021
  8. Thorsten LeemhuisNov 27, 2021
  9. Eric WongNov 27, 2021
  10. Junio C HamanoNov 27, 2021
  11. Jani NikulaNov 29, 2021
  12. Junio C HamanoNov 29, 2021
  13. Jani NikulaNov 29, 2021
  14. Eric WongNov 29, 2021
  15. Jani NikulaNov 29, 2021
  16. Geert UytterhoevenNov 30, 2021
  17. Thorsten LeemhuisDec 8, 2021
  18. Eric WongDec 8, 2021
  19. Steven RostedtNov 29, 2021

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.