Patch "checkpatch: always parse orig_commit in fixes tag" has been added to the 6.1-stable tree

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

 



This is a note to let you know that I've just added the patch titled

    checkpatch: always parse orig_commit in fixes tag

to the 6.1-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     checkpatch-always-parse-orig_commit-in-fixes-tag.patch
and it can be found in the queue-6.1 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit e62b1abfe399d2220fa072c493f54ee685d3fbdc
Author: Tamir Duberstein <tamird@xxxxxxxxx>
Date:   Fri Oct 25 19:43:19 2024 -0400

    checkpatch: always parse orig_commit in fixes tag
    
    [ Upstream commit 2f07b652384969f5d0b317e1daa5f2eb967bc73d ]
    
    Do not require the presence of `$balanced_parens` to get the commit SHA;
    this allows a `Fixes: deadbeef` tag to get a correct suggestion rather
    than a suggestion containing a reference to HEAD.
    
    Given this patch:
    
    : From: Tamir Duberstein <tamird@xxxxxxxxx>
    : Subject: Test patch
    : Date: Fri, 25 Oct 2024 19:30:51 -0400
    :
    : This is a test patch.
    :
    : Fixes: bd17e036b495
    : Signed-off-by: Tamir Duberstein <tamird@xxxxxxxxx>
    : --- /dev/null
    : +++ b/new-file
    : @@ -0,0 +1 @@
    : +Test.
    
    Before:
    
    WARNING: Please use correct Fixes: style 'Fixes: <12 chars of sha1> ("<title line>")' - ie: 'Fixes: c10a7d25e68f ("Test patch")'
    
    After:
    
    WARNING: Please use correct Fixes: style 'Fixes: <12 chars of sha1> ("<title line>")' - ie: 'Fixes: bd17e036b495 ("checkpatch: warn for non-standard fixes tag style")'
    
    The prior behavior incorrectly suggested the patch's own SHA and title
    line rather than the referenced commit's.  This fixes that.
    
    Ironically this:
    
    Fixes: bd17e036b495 ("checkpatch: warn for non-standard fixes tag style")
    Signed-off-by: Tamir Duberstein <tamird@xxxxxxxxx>
    Cc: Andy Whitcroft <apw@xxxxxxxxxxxxx>
    Cc: Dwaipayan Ray <dwaipayanray1@xxxxxxxxx>
    Cc: Joe Perches <joe@xxxxxxxxxxx>
    Cc: Louis Peens <louis.peens@xxxxxxxxxxxx>
    Cc: Lukas Bulwahn <lukas.bulwahn@xxxxxxxxx>
    Cc: Niklas Söderlund <niklas.soderlund+renesas@xxxxxxxxxxxx>
    Cc: Philippe Schenker <philippe.schenker@xxxxxxxxxxx>
    Cc: Simon Horman <horms@xxxxxxxxxx>
    Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 9ec205e6d48e2..12742da6504e0 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -3177,36 +3177,31 @@ sub process {
 
 # Check Fixes: styles is correct
 		if (!$in_header_lines &&
-		    $line =~ /^\s*fixes:?\s*(?:commit\s*)?[0-9a-f]{5,}\b/i) {
-			my $orig_commit = "";
-			my $id = "0123456789ab";
-			my $title = "commit title";
-			my $tag_case = 1;
-			my $tag_space = 1;
-			my $id_length = 1;
-			my $id_case = 1;
+		    $line =~ /^\s*(fixes:?)\s*(?:commit\s*)?([0-9a-f]{5,40})(?:\s*($balanced_parens))?/i) {
+			my $tag = $1;
+			my $orig_commit = $2;
+			my $title;
 			my $title_has_quotes = 0;
 			$fixes_tag = 1;
-
-			if ($line =~ /(\s*fixes:?)\s+([0-9a-f]{5,})\s+($balanced_parens)/i) {
-				my $tag = $1;
-				$orig_commit = $2;
-				$title = $3;
-
-				$tag_case = 0 if $tag eq "Fixes:";
-				$tag_space = 0 if ($line =~ /^fixes:? [0-9a-f]{5,} ($balanced_parens)/i);
-
-				$id_length = 0 if ($orig_commit =~ /^[0-9a-f]{12}$/i);
-				$id_case = 0 if ($orig_commit !~ /[A-F]/);
-
+			if (defined $3) {
 				# Always strip leading/trailing parens then double quotes if existing
-				$title = substr($title, 1, -1);
+				$title = substr($3, 1, -1);
 				if ($title =~ /^".*"$/) {
 					$title = substr($title, 1, -1);
 					$title_has_quotes = 1;
 				}
+			} else {
+				$title = "commit title"
 			}
 
+
+			my $tag_case = not ($tag eq "Fixes:");
+			my $tag_space = not ($line =~ /^fixes:? [0-9a-f]{5,40} ($balanced_parens)/i);
+
+			my $id_length = not ($orig_commit =~ /^[0-9a-f]{12}$/i);
+			my $id_case = not ($orig_commit !~ /[A-F]/);
+
+			my $id = "0123456789ab";
 			my ($cid, $ctitle) = git_commit_info($orig_commit, $id,
 							     $title);
 




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux