The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Andrew Morton <akpm@linux-foundation.org>,
	Ian Rogers <irogers@google.com>
Cc: Kuan-Wei Chiu <visitorckw@gmail.com>,
	Dwaipayan Ray	 <dwaipayanray1@gmail.com>,
	Lukas Bulwahn <lukas.bulwahn@gmail.com>,
	Stephen Rothwell <sfr@canb.auug.org.au>,
	Andy Whitcroft <apw@canonical.com>,
	linux-kernel@vger.kernel.org,  Namhyung Kim <namhyung@kernel.org>
Subject: [PATCH] checkpatch: Add an invalid patch separator test
Date: Fri, 16 Jan 2026 09:42:52 -0800	[thread overview]
Message-ID: <6ec1ed08328340db42655287afd5fa4067316b11.camel@perches.com> (raw)
In-Reply-To: <20260113193319.701e5799059eb642bbfc9a04@linux-foundation.org>

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@perches.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;

  parent reply	other threads:[~2026-01-16 17:43 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-05  5:34 [PATCH v1] checkpatch: Warn about sign offs if there's an accidental patch separator Ian Rogers
2025-12-05  7:22 ` Kuan-Wei Chiu
2026-01-04  1:10   ` Ian Rogers
2026-01-04 17:37     ` Kuan-Wei Chiu
     [not found]       ` <195a2cba2b461a0ab99ae004bdf079b038db8b07.camel@perches.com>
2026-01-04 21:13         ` Ian Rogers
2026-01-04 22:22           ` Joe Perches
2026-01-05 15:39             ` Ian Rogers
2026-01-05 16:46               ` Joe Perches
2026-01-05 17:13                 ` Ian Rogers
2026-01-14  3:33                   ` Andrew Morton
2026-01-14  5:29                     ` Stephen Rothwell
2026-01-14 18:20                     ` Joe Perches
2026-01-14 19:01                       ` Ian Rogers
2026-01-16 17:42                     ` Joe Perches [this message]
2026-01-16 20:48                       ` [PATCH] checkpatch: Add an invalid patch separator test Andrew Morton

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=6ec1ed08328340db42655287afd5fa4067316b11.camel@perches.com \
    --to=joe@perches.com \
    --cc=akpm@linux-foundation.org \
    --cc=apw@canonical.com \
    --cc=dwaipayanray1@gmail.com \
    --cc=irogers@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lukas.bulwahn@gmail.com \
    --cc=namhyung@kernel.org \
    --cc=sfr@canb.auug.org.au \
    --cc=visitorckw@gmail.com \
    /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