[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <6ec1ed08328340db42655287afd5fa4067316b11.camel@perches.com>
Date: Fri, 16 Jan 2026 09:42:52 -0800
From: Joe Perches <joe@...ches.com>
To: Andrew Morton <akpm@...ux-foundation.org>, Ian Rogers
<irogers@...gle.com>
Cc: Kuan-Wei Chiu <visitorckw@...il.com>, Dwaipayan Ray
<dwaipayanray1@...il.com>, Lukas Bulwahn <lukas.bulwahn@...il.com>, Stephen
Rothwell <sfr@...b.auug.org.au>, Andy Whitcroft <apw@...onical.com>,
linux-kernel@...r.kernel.org, Namhyung Kim <namhyung@...nel.org>
Subject: [PATCH] checkpatch: Add an invalid patch separator test
Some versions of tools that apply patches incorrectly allow lines that
start with 3 dashes and have additional content on the same line.
Checkpatch will now emit an ERROR on these lines and optionally
convert those lines from dashes to equals with --fix.
Signed-off-by: Joe Perches <joe@...ches.com>
---
Documentation/dev-tools/checkpatch.rst | 5 +++++
scripts/checkpatch.pl | 10 ++++++++++
2 files changed, 15 insertions(+)
diff --git a/Documentation/dev-tools/checkpatch.rst b/Documentation/dev-tools/checkpatch.rst
index ca475805df4c8..dccede68698ca 100644
--- a/Documentation/dev-tools/checkpatch.rst
+++ b/Documentation/dev-tools/checkpatch.rst
@@ -601,6 +601,11 @@ Commit message
See: https://www.kernel.org/doc/html/latest/process/submitting-patches.html#describe-your-changes
+ **BAD_COMMIT_SEPARATOR**
+ The commit separator is a single line with 3 dashes.
+ The regex match is '^---$'
+ Lines that start with 3 dashes and have more content on the same line
+ may confuse tools that apply patches.
Comparison style
----------------
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index e0f1d6a6bc636..a11f88d11edd8 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -3035,6 +3035,16 @@ sub process {
}
}
+# Check for invalid patch separator
+ if ($in_commit_log &&
+ $line =~ /^---.+/) {
+ if (ERROR("BAD_COMMIT_SEPARATOR",
+ "Invalid commit separator - some tools may have problems applying this\n" . $herecurr) &&
+ $fix) {
+ $fixed[$fixlinenr] =~ s/-/=/g;
+ }
+ }
+
# Check for patch separator
if ($line =~ /^---$/) {
$has_patch_separator = 1;
Powered by blists - more mailing lists