Re: [PATCH] checkpatch: Fix bad FILE_PATH_CHANGES on headers
From: Joe Perches
Date: Sat Nov 07 2026 - 21:17:43 EST
On Sat, 2026-11-07 at 16:02 +0100, Pierre-Clément Tosi wrote:
> 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.
cute. Thanks again.
Acked-by: Joe Perches <joe@xxxxxxxxxxx>
>
> 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@xxxxxxxxxx>
> ---
> 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,