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 <[email protected]>
Fixes: 910e1d41be6b2 ("scripts/checkpatch: validate Fixes: tag format and commit 
ancestry")
Signed-off-by: Peter Maydell <[email protected]>
---
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é <[email protected]>

Reply via email to