mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Pierre-Clément Tosi" <ptosi@google.com>
To: Andy Whitcroft <apw@canonical.com>, Joe Perches <joe@perches.com>,
	 Andrew Morton <akpm@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org, "Pierre-Clément Tosi" <ptosi@google.com>
Subject: [PATCH] checkpatch: Fix bad FILE_PATH_CHANGES on headers
Date: Sat, 07 Nov 2026 16:02:36 +0100	[thread overview]
Message-ID: <20261107-checkpatch-file_path_changes-v1-1-8b11814560d8@google.com> (raw)

The FILE_PATH_CHANGES warning ("added, moved or deleted file(s), does
MAINTAINERS need updating?") added by commit 13f1937ef339 ("checkpatch:
emit a warning on file add/move/delete") was guarded by !$in_commit_log
so that commit message lines would not be mistaken for diffstat or diff
header lines.

However, it was still evaluated on the initial email header lines
($in_header_lines == 1) such that a title using the rename notation e.g.

    Subject: [PATCH] foo: rework bar_{get=>set}_baz()

triggers a false-positive warning. Furthermore, that same (wrong) code
path sets $is_patch prematurely.

Instead, only test for FILE_PATH_CHANGES when !$in_header_lines.

Fixes: 13f1937ef339 ("checkpatch: emit a warning on file add/move/delete")
Signed-off-by: Pierre-Clément Tosi <ptosi@google.com>
---
 scripts/checkpatch.pl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index b8b64f720191..03e3e4b72cdd 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -3481,7 +3481,7 @@ sub process {
 		}
 
 # Check for added, moved or deleted files
-		if (!$reported_maintainer_file && !$in_commit_log &&
+		if (!$reported_maintainer_file && !$in_commit_log && !$in_header_lines &&
 		    ($line =~ /^(?:new|deleted) file mode\s*\d+\s*$/ ||
 		     $line =~ /^rename (?:from|to) [\w\/\.\-]+\s*$/ ||
 		     ($line =~ /\{\s*([\w\/\.\-]*)\s*\=\>\s*([\w\/\.\-]*)\s*\}/ &&

---
base-commit: 6628e7d4c6b25c8d18f1345e3a20d21829aae7e4
change-id: 20261107-checkpatch-file_path_changes-ac920c85bc7e

Best regards,
-- 
Pierre-Clément Tosi <ptosi@google.com>


                 reply	other threads:[~2026-11-07 15:02 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261107-checkpatch-file_path_changes-v1-1-8b11814560d8@google.com \
    --to=ptosi@google.com \
    --cc=akpm@linux-foundation.org \
    --cc=apw@canonical.com \
    --cc=joe@perches.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®