The checkpatch.pl script insists that Fixes tags are at the start of
each line of its input. Although this is where they ought to be
in the commit message, it is not where the script will see them
in common usage patterns like
git show <hash> | ./scripts/checkpatch.pl -
because 'git show' prefaces each line of the commit message body with
four spaces. Allow spaces before the Fixes tag; this matches how we
check for e.g. Signed-off-by: tags.
Reported-by: Stefano Garzarella <sgarzare@redhat.com>
Fixes: 910e1d41be6b2 ("scripts/checkpatch: validate Fixes: tag format and commit ancestry")
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
I just ran into this myself today as well so wrote up the patch
---
scripts/checkpatch.pl | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 5df266acb17..82f62f60212 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -1889,7 +1889,7 @@ sub process {
if ($line !~ /^\s*Fixes:\s+CVE/i) {
my $tag_case = not ($tag eq "Fixes:");
- my $tag_space = not ($line =~ /^fixes:? [0-9a-f]{5,40}/i);
+ my $tag_space = not ($line =~ /^\s*fixes:? [0-9a-f]{5,40}/i);
my $id_length = not ($orig_commit =~ /^[0-9a-f]{12,40}$/);
my $id_case = not ($orig_commit !~ /[A-F]/);
--
2.43.0
On 10/23/26 17:23, Peter Maydell wrote:
> The checkpatch.pl script insists that Fixes tags are at the start of
> each line of its input. Although this is where they ought to be
> in the commit message, it is not where the script will see them
> in common usage patterns like
>
> git show <hash> | ./scripts/checkpatch.pl -
ah. I didn't think of that usage ...
> because 'git show' prefaces each line of the commit message body with
> four spaces. Allow spaces before the Fixes tag; this matches how we
> check for e.g. Signed-off-by: tags.
>
> Reported-by: Stefano Garzarella <sgarzare@redhat.com>
> Fixes: 910e1d41be6b2 ("scripts/checkpatch: validate Fixes: tag format and commit ancestry")
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
> I just ran into this myself today as well so wrote up the patch
> ---
> scripts/checkpatch.pl | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index 5df266acb17..82f62f60212 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -1889,7 +1889,7 @@ sub process {
>
> if ($line !~ /^\s*Fixes:\s+CVE/i) {
> my $tag_case = not ($tag eq "Fixes:");
> - my $tag_space = not ($line =~ /^fixes:? [0-9a-f]{5,40}/i);
> + my $tag_space = not ($line =~ /^\s*fixes:? [0-9a-f]{5,40}/i);
> my $id_length = not ($orig_commit =~ /^[0-9a-f]{12,40}$/);
> my $id_case = not ($orig_commit !~ /[A-F]/);
>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Thank for the fix,
C.
On Mon, 26 Oct 2026 at 09:42, Cédric Le Goater <clg@redhat.com> wrote:
>
> On 10/23/26 17:23, Peter Maydell wrote:
> > The checkpatch.pl script insists that Fixes tags are at the start of
> > each line of its input. Although this is where they ought to be
> > in the commit message, it is not where the script will see them
> > in common usage patterns like
> >
> > git show <hash> | ./scripts/checkpatch.pl -
>
> ah. I didn't think of that usage ...
For the reference, I hit with `./scripts/checkpatch.pl --branch master..HEAD`.
Thanks,
Stefano
>
> > because 'git show' prefaces each line of the commit message body with
> > four spaces. Allow spaces before the Fixes tag; this matches how we
> > check for e.g. Signed-off-by: tags.
> >
> > Reported-by: Stefano Garzarella <sgarzare@redhat.com>
> > Fixes: 910e1d41be6b2 ("scripts/checkpatch: validate Fixes: tag format and commit ancestry")
> > Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> > ---
> > I just ran into this myself today as well so wrote up the patch
> > ---
> > scripts/checkpatch.pl | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> > index 5df266acb17..82f62f60212 100755
> > --- a/scripts/checkpatch.pl
> > +++ b/scripts/checkpatch.pl
> > @@ -1889,7 +1889,7 @@ sub process {
> >
> > if ($line !~ /^\s*Fixes:\s+CVE/i) {
> > my $tag_case = not ($tag eq "Fixes:");
> > - my $tag_space = not ($line =~ /^fixes:? [0-9a-f]{5,40}/i);
> > + my $tag_space = not ($line =~ /^\s*fixes:? [0-9a-f]{5,40}/i);
> > my $id_length = not ($orig_commit =~ /^[0-9a-f]{12,40}$/);
> > my $id_case = not ($orig_commit !~ /[A-F]/);
> >
>
>
>
> Reviewed-by: Cédric Le Goater <clg@redhat.com>
>
> Thank for the fix,
>
> C.
>
On 23/10/26 17:23, Peter Maydell wrote:
> The checkpatch.pl script insists that Fixes tags are at the start of
> each line of its input. Although this is where they ought to be
> in the commit message, it is not where the script will see them
> in common usage patterns like
>
> git show <hash> | ./scripts/checkpatch.pl -
>
> because 'git show' prefaces each line of the commit message body with
> four spaces. Allow spaces before the Fixes tag; this matches how we
> check for e.g. Signed-off-by: tags.
>
> Reported-by: Stefano Garzarella <sgarzare@redhat.com>
> Fixes: 910e1d41be6b2 ("scripts/checkpatch: validate Fixes: tag format and commit ancestry")
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
> I just ran into this myself today as well so wrote up the patch
> ---
> scripts/checkpatch.pl | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index 5df266acb17..82f62f60212 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -1889,7 +1889,7 @@ sub process {
>
> if ($line !~ /^\s*Fixes:\s+CVE/i) {
> my $tag_case = not ($tag eq "Fixes:");
> - my $tag_space = not ($line =~ /^fixes:? [0-9a-f]{5,40}/i);
> + my $tag_space = not ($line =~ /^\s*fixes:? [0-9a-f]{5,40}/i);
> my $id_length = not ($orig_commit =~ /^[0-9a-f]{12,40}$/);
> my $id_case = not ($orig_commit !~ /[A-F]/);
>
ERROR: line over 90 characters
#36: FILE: scripts/checkpatch.pl:1882:
+ my $tag_space = not ($line =~ /^\s*fixes:? [0-9a-f]{5,40}/i);
WARNING: Please use correct Fixes: style 'Fixes: <12+ chars of sha1>
("<title line>")' - ie: 'Fixes: 471d4930470a ("target-alpha: Set
fpcr_exc_status even for disabled exceptions")'
#24:
Fixes: 471d493047 ("target-alpha: Set fpcr_exc_status even for
disabled exceptions")
$ git log -1 --format='Fixes: %h (\"%s\")%nCc: %aE' 471d493047
Fixes: 471d4930470 (\"target-alpha: Set fpcr_exc_status even for
disabled exceptions\")
Cédric, what is the format we have to use? (why mine default to 11
chars and yours to 12?)
At least that removed one warning on my side, so:
Tested-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
On 10/23/26 17:59, Philippe Mathieu-Daudé wrote:
> On 23/10/26 17:23, Peter Maydell wrote:
>> The checkpatch.pl script insists that Fixes tags are at the start of
>> each line of its input. Although this is where they ought to be
>> in the commit message, it is not where the script will see them
>> in common usage patterns like
>>
>> git show <hash> | ./scripts/checkpatch.pl -
>>
>> because 'git show' prefaces each line of the commit message body with
>> four spaces. Allow spaces before the Fixes tag; this matches how we
>> check for e.g. Signed-off-by: tags.
>>
>> Reported-by: Stefano Garzarella <sgarzare@redhat.com>
>> Fixes: 910e1d41be6b2 ("scripts/checkpatch: validate Fixes: tag format and commit ancestry")
>> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
>> ---
>> I just ran into this myself today as well so wrote up the patch
>> ---
>> scripts/checkpatch.pl | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
>> index 5df266acb17..82f62f60212 100755
>> --- a/scripts/checkpatch.pl
>> +++ b/scripts/checkpatch.pl
>> @@ -1889,7 +1889,7 @@ sub process {
>> if ($line !~ /^\s*Fixes:\s+CVE/i) {
>> my $tag_case = not ($tag eq "Fixes:");
>> - my $tag_space = not ($line =~ /^fixes:? [0-9a-f]{5,40}/i);
>> + my $tag_space = not ($line =~ /^\s*fixes:? [0-9a-f]{5,40}/i);
>> my $id_length = not ($orig_commit =~ /^[0-9a-f]{12,40}$/);
>> my $id_case = not ($orig_commit !~ /[A-F]/);
>
> ERROR: line over 90 characters
> #36: FILE: scripts/checkpatch.pl:1882:
> + my $tag_space = not ($line =~ /^\s*fixes:? [0-9a-f]{5,40}/i);
> WARNING: Please use correct Fixes: style 'Fixes: <12+ chars of sha1> ("<title line>")' - ie: 'Fixes: 471d4930470a ("target-alpha: Set fpcr_exc_status even for disabled exceptions")'
> #24:
> Fixes: 471d493047 ("target-alpha: Set fpcr_exc_status even for disabled exceptions")
>
> $ git log -1 --format='Fixes: %h (\"%s\")%nCc: %aE' 471d493047
> Fixes: 471d4930470 (\"target-alpha: Set fpcr_exc_status even for disabled exceptions\")
>
> Cédric, what is the format we have to use? (why mine default to 11
> chars and yours to 12?)
12 chars is mentioned in the doc :
docs/devel/submitting-a-patch.rst:add an additional line with "Fixes: <at-least-12-digits-of-SHA-commit-id
Thanks,
C.
On 26/10/26 09:40, Cédric Le Goater wrote:
> On 10/23/26 17:59, Philippe Mathieu-Daudé wrote:
>> On 23/10/26 17:23, Peter Maydell wrote:
>>> The checkpatch.pl script insists that Fixes tags are at the start of
>>> each line of its input. Although this is where they ought to be
>>> in the commit message, it is not where the script will see them
>>> in common usage patterns like
>>>
>>> git show <hash> | ./scripts/checkpatch.pl -
>>>
>>> because 'git show' prefaces each line of the commit message body with
>>> four spaces. Allow spaces before the Fixes tag; this matches how we
>>> check for e.g. Signed-off-by: tags.
>>>
>>> Reported-by: Stefano Garzarella <sgarzare@redhat.com>
>>> Fixes: 910e1d41be6b2 ("scripts/checkpatch: validate Fixes: tag format
>>> and commit ancestry")
>>> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
>>> ---
>>> I just ran into this myself today as well so wrote up the patch
>>> ---
>>> scripts/checkpatch.pl | 2 +-
>>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
>>> index 5df266acb17..82f62f60212 100755
>>> --- a/scripts/checkpatch.pl
>>> +++ b/scripts/checkpatch.pl
>>> @@ -1889,7 +1889,7 @@ sub process {
>>> if ($line !~ /^\s*Fixes:\s+CVE/i) {
>>> my $tag_case = not ($tag eq "Fixes:");
>>> - my $tag_space = not ($line =~ /^fixes:? [0-9a-f]
>>> {5,40}/i);
>>> + my $tag_space = not ($line =~ /^\s*fixes:? [0-9a-f]
>>> {5,40}/i);
>>> my $id_length = not ($orig_commit =~ /^[0-9a-f]
>>> {12,40}$/);
>>> my $id_case = not ($orig_commit !~ /[A-F]/);
>>
>> ERROR: line over 90 characters
>> #36: FILE: scripts/checkpatch.pl:1882:
>> + my $tag_space = not ($line =~ /^\s*fixes:? [0-9a-f]
>> {5,40}/i);
>> WARNING: Please use correct Fixes: style 'Fixes: <12+ chars of sha1>
>> ("<title line>")' - ie: 'Fixes: 471d4930470a ("target-alpha: Set
>> fpcr_exc_status even for disabled exceptions")'
>> #24:
>> Fixes: 471d493047 ("target-alpha: Set fpcr_exc_status even for
>> disabled exceptions")
>>
>> $ git log -1 --format='Fixes: %h (\"%s\")%nCc: %aE' 471d493047
>> Fixes: 471d4930470 (\"target-alpha: Set fpcr_exc_status even for
>> disabled exceptions\")
>>
>> Cédric, what is the format we have to use? (why mine default to 11
>> chars and yours to 12?)
>
>
> 12 chars is mentioned in the doc :
>
> docs/devel/submitting-a-patch.rst:add an additional line with "Fixes:
> <at-least-12-digits-of-SHA-commit-id
Figured it, we have to use --abbrev=12:
git log --abbrev=12 -1 --format='Fixes: %h (\"%s\")%nCc: %aE' 471d493047
Fixes: 471d4930470a (\"target-alpha: Set fpcr_exc_status even for
disabled exceptions\")
Or simpler update .gitconfig:
$ git config core.abbrev 12
Kashyap, you added that requirement in commit cd6b1674d6112,
do you mind mention how to configure git-config too?
Regards.
Phil.
On Fri, 23 Oct 2026 at 17:24, Peter Maydell <peter.maydell@linaro.org> wrote:
>
> The checkpatch.pl script insists that Fixes tags are at the start of
> each line of its input. Although this is where they ought to be
> in the commit message, it is not where the script will see them
> in common usage patterns like
>
> git show <hash> | ./scripts/checkpatch.pl -
>
> because 'git show' prefaces each line of the commit message body with
> four spaces. Allow spaces before the Fixes tag; this matches how we
> check for e.g. Signed-off-by: tags.
>
> Reported-by: Stefano Garzarella <sgarzare@redhat.com>
> Fixes: 910e1d41be6b2 ("scripts/checkpatch: validate Fixes: tag format and commit ancestry")
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
> I just ran into this myself today as well so wrote up the patch
Thanks for that!
Tested-by: Stefano Garzarella <sgarzare@redhat.com>
© 2016 - 2026 Red Hat, Inc.