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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]


On Sat, 27 Nov 2021, Junio C Hamano <gitster@xxxxxxxxx> wrote:
> Eric Wong <e@xxxxxxxxx> writes:
>> Thorsten Leemhuis <linux@xxxxxxxxxxxxx> 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:$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:$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: (comment) 

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.


Jani Nikula, Intel Open Source Graphics Center

[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux