* [PATCH v1] checkpatch: Warn about sign offs if there's an accidental patch separator
@ 2025-12-05 5:34 Ian Rogers
2025-12-05 7:22 ` Kuan-Wei Chiu
0 siblings, 1 reply; 15+ messages in thread
From: Ian Rogers @ 2025-12-05 5:34 UTC (permalink / raw)
To: Andy Whitcroft, Joe Perches, Dwaipayan Ray, Lukas Bulwahn,
linux-kernel
Cc: Namhyung Kim, Stephen Rothwell, Ian Rogers
The regex ^---$ to detect a patch separator, means a patch is
considerd to have been separated only when the line is exactly just
"---". git-mailinfo (and thus git am) treats any line starting with
"---" as the start of a patch. This can mean a comment causes
git-mailinfo to truncate the commit message if the line in the comment
starts with "---". checkpatch won't warn about things like missing
sign offs after the "---" started comment as it doesn't see the patch
as having started yet. The recording of sign offs is made to ignore
the case it is in a patch. This issue caused missing tags in commit
6528cdd61590 ("perf tests stat: Add test for error for an offline CPU")
as reported by Stephen Rothwell <sfr@canb.auug.org.au> in:
https://lore.kernel.org/lkml/20251205092428.3e2b94e3@canb.auug.org.au/
Before:
$ ./scripts/checkpatch.pl v2-0006-perf-tests-stat-Add-test-for-error-for-an-offline.patch
total: 0 errors, 0 warnings, 39 lines checked
v2-0006-perf-tests-stat-Add-test-for-error-for-an-offline.patch has no obvious style problems and is ready for submission.
After:
$ ./scripts/checkpatch.pl v2-0006-perf-tests-stat-Add-test-for-error-for-an-offline.patch
ERROR: Missing Signed-off-by: line(s)
total: 1 errors, 0 warnings, 39 lines checked
NOTE: For some of the reported defects, checkpatch may be able to
mechanically convert to the typical style using --fix or --fix-inplace.
v2-0006-perf-tests-stat-Add-test-for-error-for-an-offline.patch has style problems, please review.
NOTE: If any of the errors are false positives, please report
them to the maintainer, see CHECKPATCH in MAINTAINERS.
Signed-off-by: Ian Rogers <irogers@google.com>
---
scripts/checkpatch.pl | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 92669904eecc..4fb04162ee56 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -2819,6 +2819,11 @@ sub process {
$is_patch = 1;
}
+# Once the patch separator is encountered git-mailinfo will treat the rest as a patch
+ if ($has_patch_separator) {
+ $is_patch = 1;
+ }
+
#extract the line range in the file after the patch is applied
if (!$in_commit_log &&
$line =~ /^\@\@ -\d+(?:,\d+)? \+(\d+)(,(\d+))? \@\@(.*)/) {
@@ -2989,7 +2994,7 @@ sub process {
}
# Check the patch for a signoff:
- if ($line =~ /^\s*signed-off-by:\s*(.*)/i) {
+ if (!$is_patch && $line =~ /^\s*signed-off-by:\s*(.*)/i) {
$signoff++;
$in_commit_log = 0;
if ($author ne '' && $authorsignoff != 1) {
@@ -3028,7 +3033,7 @@ sub process {
}
# Check for patch separator
- if ($line =~ /^---$/) {
+ if ($line =~ /^---/) {
$has_patch_separator = 1;
$in_commit_log = 0;
}
--
2.52.0.223.gf5cc29aaa4-goog
^ permalink raw reply related [flat|nested] 15+ messages in thread* Re: [PATCH v1] checkpatch: Warn about sign offs if there's an accidental patch separator 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 0 siblings, 1 reply; 15+ messages in thread From: Kuan-Wei Chiu @ 2025-12-05 7:22 UTC (permalink / raw) To: Ian Rogers Cc: Andy Whitcroft, Joe Perches, Dwaipayan Ray, Lukas Bulwahn, linux-kernel, Namhyung Kim, Stephen Rothwell On Thu, Dec 04, 2025 at 09:34:57PM -0800, Ian Rogers wrote: > The regex ^---$ to detect a patch separator, means a patch is > considerd to have been separated only when the line is exactly just > "---". git-mailinfo (and thus git am) treats any line starting with > "---" as the start of a patch. This can mean a comment causes > git-mailinfo to truncate the commit message if the line in the comment > starts with "---". checkpatch won't warn about things like missing > sign offs after the "---" started comment as it doesn't see the patch > as having started yet. The recording of sign offs is made to ignore > the case it is in a patch. This issue caused missing tags in commit > 6528cdd61590 ("perf tests stat: Add test for error for an offline CPU") I guess Namhyung might fix up this commit and force push the branch, meaning this specific sha id won't exist in Linus' tree later. Given that, I'm not sure it is appropriate to reference this sha id here? > as reported by Stephen Rothwell <sfr@canb.auug.org.au> in: > https://lore.kernel.org/lkml/20251205092428.3e2b94e3@canb.auug.org.au/ > > Before: > > $ ./scripts/checkpatch.pl v2-0006-perf-tests-stat-Add-test-for-error-for-an-offline.patch > total: 0 errors, 0 warnings, 39 lines checked > > v2-0006-perf-tests-stat-Add-test-for-error-for-an-offline.patch has no obvious style problems and is ready for submission. > > After: > > $ ./scripts/checkpatch.pl v2-0006-perf-tests-stat-Add-test-for-error-for-an-offline.patch > ERROR: Missing Signed-off-by: line(s) > > total: 1 errors, 0 warnings, 39 lines checked > > NOTE: For some of the reported defects, checkpatch may be able to > mechanically convert to the typical style using --fix or --fix-inplace. > > v2-0006-perf-tests-stat-Add-test-for-error-for-an-offline.patch has style problems, please review. > > NOTE: If any of the errors are false positives, please report > them to the maintainer, see CHECKPATCH in MAINTAINERS. > > Signed-off-by: Ian Rogers <irogers@google.com> FWIW: Tested-by: Kuan-Wei Chiu <visitorckw@gmail.com> Regards, Kuan-Wei > --- > scripts/checkpatch.pl | 9 +++++++-- > 1 file changed, 7 insertions(+), 2 deletions(-) > > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl > index 92669904eecc..4fb04162ee56 100755 > --- a/scripts/checkpatch.pl > +++ b/scripts/checkpatch.pl > @@ -2819,6 +2819,11 @@ sub process { > $is_patch = 1; > } > > +# Once the patch separator is encountered git-mailinfo will treat the rest as a patch > + if ($has_patch_separator) { > + $is_patch = 1; > + } > + > #extract the line range in the file after the patch is applied > if (!$in_commit_log && > $line =~ /^\@\@ -\d+(?:,\d+)? \+(\d+)(,(\d+))? \@\@(.*)/) { > @@ -2989,7 +2994,7 @@ sub process { > } > > # Check the patch for a signoff: > - if ($line =~ /^\s*signed-off-by:\s*(.*)/i) { > + if (!$is_patch && $line =~ /^\s*signed-off-by:\s*(.*)/i) { > $signoff++; > $in_commit_log = 0; > if ($author ne '' && $authorsignoff != 1) { > @@ -3028,7 +3033,7 @@ sub process { > } > > # Check for patch separator > - if ($line =~ /^---$/) { > + if ($line =~ /^---/) { > $has_patch_separator = 1; > $in_commit_log = 0; > } > -- > 2.52.0.223.gf5cc29aaa4-goog > > ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v1] checkpatch: Warn about sign offs if there's an accidental patch separator 2025-12-05 7:22 ` Kuan-Wei Chiu @ 2026-01-04 1:10 ` Ian Rogers 2026-01-04 17:37 ` Kuan-Wei Chiu 0 siblings, 1 reply; 15+ messages in thread From: Ian Rogers @ 2026-01-04 1:10 UTC (permalink / raw) To: Kuan-Wei Chiu, Dwaipayan Ray, Lukas Bulwahn, Stephen Rothwell, Andy Whitcroft Cc: linux-kernel, Namhyung Kim On Thu, Dec 4, 2025 at 11:22 PM Kuan-Wei Chiu <visitorckw@gmail.com> wrote: > > On Thu, Dec 04, 2025 at 09:34:57PM -0800, Ian Rogers wrote: > > The regex ^---$ to detect a patch separator, means a patch is > > considerd to have been separated only when the line is exactly just > > "---". git-mailinfo (and thus git am) treats any line starting with > > "---" as the start of a patch. This can mean a comment causes > > git-mailinfo to truncate the commit message if the line in the comment > > starts with "---". checkpatch won't warn about things like missing > > sign offs after the "---" started comment as it doesn't see the patch > > as having started yet. The recording of sign offs is made to ignore > > the case it is in a patch. This issue caused missing tags in commit > > 6528cdd61590 ("perf tests stat: Add test for error for an offline CPU") > > I guess Namhyung might fix up this commit and force push the branch, > meaning this specific sha id won't exist in Linus' tree later. Given > that, I'm not sure it is appropriate to reference this sha id here? > > > as reported by Stephen Rothwell <sfr@canb.auug.org.au> in: > > https://lore.kernel.org/lkml/20251205092428.3e2b94e3@canb.auug.org.au/ > > > > Before: > > > > $ ./scripts/checkpatch.pl v2-0006-perf-tests-stat-Add-test-for-error-for-an-offline.patch > > total: 0 errors, 0 warnings, 39 lines checked > > > > v2-0006-perf-tests-stat-Add-test-for-error-for-an-offline.patch has no obvious style problems and is ready for submission. > > > > After: > > > > $ ./scripts/checkpatch.pl v2-0006-perf-tests-stat-Add-test-for-error-for-an-offline.patch > > ERROR: Missing Signed-off-by: line(s) > > > > total: 1 errors, 0 warnings, 39 lines checked > > > > NOTE: For some of the reported defects, checkpatch may be able to > > mechanically convert to the typical style using --fix or --fix-inplace. > > > > v2-0006-perf-tests-stat-Add-test-for-error-for-an-offline.patch has style problems, please review. > > > > NOTE: If any of the errors are false positives, please report > > them to the maintainer, see CHECKPATCH in MAINTAINERS. > > > > Signed-off-by: Ian Rogers <irogers@google.com> > > FWIW: > > Tested-by: Kuan-Wei Chiu <visitorckw@gmail.com> Thanks Kuan-Wei! Is there anything else I need to do for this improvement to land? Thanks, Ian > Regards, > Kuan-Wei > > > --- > > scripts/checkpatch.pl | 9 +++++++-- > > 1 file changed, 7 insertions(+), 2 deletions(-) > > > > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl > > index 92669904eecc..4fb04162ee56 100755 > > --- a/scripts/checkpatch.pl > > +++ b/scripts/checkpatch.pl > > @@ -2819,6 +2819,11 @@ sub process { > > $is_patch = 1; > > } > > > > +# Once the patch separator is encountered git-mailinfo will treat the rest as a patch > > + if ($has_patch_separator) { > > + $is_patch = 1; > > + } > > + > > #extract the line range in the file after the patch is applied > > if (!$in_commit_log && > > $line =~ /^\@\@ -\d+(?:,\d+)? \+(\d+)(,(\d+))? \@\@(.*)/) { > > @@ -2989,7 +2994,7 @@ sub process { > > } > > > > # Check the patch for a signoff: > > - if ($line =~ /^\s*signed-off-by:\s*(.*)/i) { > > + if (!$is_patch && $line =~ /^\s*signed-off-by:\s*(.*)/i) { > > $signoff++; > > $in_commit_log = 0; > > if ($author ne '' && $authorsignoff != 1) { > > @@ -3028,7 +3033,7 @@ sub process { > > } > > > > # Check for patch separator > > - if ($line =~ /^---$/) { > > + if ($line =~ /^---/) { > > $has_patch_separator = 1; > > $in_commit_log = 0; > > } > > -- > > 2.52.0.223.gf5cc29aaa4-goog > > > > ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v1] checkpatch: Warn about sign offs if there's an accidental patch separator 2026-01-04 1:10 ` Ian Rogers @ 2026-01-04 17:37 ` Kuan-Wei Chiu [not found] ` <195a2cba2b461a0ab99ae004bdf079b038db8b07.camel@perches.com> 0 siblings, 1 reply; 15+ messages in thread From: Kuan-Wei Chiu @ 2026-01-04 17:37 UTC (permalink / raw) To: Ian Rogers Cc: Dwaipayan Ray, Lukas Bulwahn, Stephen Rothwell, Andy Whitcroft, Joe Perches, linux-kernel, Namhyung Kim, Andrew Morton +Cc Andrew Morton, On Sat, Jan 03, 2026 at 05:10:22PM -0800, Ian Rogers wrote: > On Thu, Dec 4, 2025 at 11:22 PM Kuan-Wei Chiu <visitorckw@gmail.com> wrote: > > > > On Thu, Dec 04, 2025 at 09:34:57PM -0800, Ian Rogers wrote: > > > The regex ^---$ to detect a patch separator, means a patch is > > > considerd to have been separated only when the line is exactly just > > > "---". git-mailinfo (and thus git am) treats any line starting with > > > "---" as the start of a patch. This can mean a comment causes > > > git-mailinfo to truncate the commit message if the line in the comment > > > starts with "---". checkpatch won't warn about things like missing > > > sign offs after the "---" started comment as it doesn't see the patch > > > as having started yet. The recording of sign offs is made to ignore > > > the case it is in a patch. This issue caused missing tags in commit > > > 6528cdd61590 ("perf tests stat: Add test for error for an offline CPU") > > > > I guess Namhyung might fix up this commit and force push the branch, > > meaning this specific sha id won't exist in Linus' tree later. Given > > that, I'm not sure it is appropriate to reference this sha id here? > > > > > as reported by Stephen Rothwell <sfr@canb.auug.org.au> in: > > > https://lore.kernel.org/lkml/20251205092428.3e2b94e3@canb.auug.org.au/ > > > > > > Before: > > > > > > $ ./scripts/checkpatch.pl v2-0006-perf-tests-stat-Add-test-for-error-for-an-offline.patch > > > total: 0 errors, 0 warnings, 39 lines checked > > > > > > v2-0006-perf-tests-stat-Add-test-for-error-for-an-offline.patch has no obvious style problems and is ready for submission. > > > > > > After: > > > > > > $ ./scripts/checkpatch.pl v2-0006-perf-tests-stat-Add-test-for-error-for-an-offline.patch > > > ERROR: Missing Signed-off-by: line(s) > > > > > > total: 1 errors, 0 warnings, 39 lines checked > > > > > > NOTE: For some of the reported defects, checkpatch may be able to > > > mechanically convert to the typical style using --fix or --fix-inplace. > > > > > > v2-0006-perf-tests-stat-Add-test-for-error-for-an-offline.patch has style problems, please review. > > > > > > NOTE: If any of the errors are false positives, please report > > > them to the maintainer, see CHECKPATCH in MAINTAINERS. > > > > > > Signed-off-by: Ian Rogers <irogers@google.com> > > > > FWIW: > > > > Tested-by: Kuan-Wei Chiu <visitorckw@gmail.com> > > Thanks Kuan-Wei! Is there anything else I need to do for this > improvement to land? IIRC, most checkpatch.pl related patches are routed through the mm-nonmm branch, so I am Cc'ing Andrew for help picking this up. That said, any Ack/Review or feedback from checkpatch.pl maintainers/reviewers would still be helpful and appreciated. Regards, Kuan-Wei > > > --- > > > scripts/checkpatch.pl | 9 +++++++-- > > > 1 file changed, 7 insertions(+), 2 deletions(-) > > > > > > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl > > > index 92669904eecc..4fb04162ee56 100755 > > > --- a/scripts/checkpatch.pl > > > +++ b/scripts/checkpatch.pl > > > @@ -2819,6 +2819,11 @@ sub process { > > > $is_patch = 1; > > > } > > > > > > +# Once the patch separator is encountered git-mailinfo will treat the rest as a patch > > > + if ($has_patch_separator) { > > > + $is_patch = 1; > > > + } > > > + > > > #extract the line range in the file after the patch is applied > > > if (!$in_commit_log && > > > $line =~ /^\@\@ -\d+(?:,\d+)? \+(\d+)(,(\d+))? \@\@(.*)/) { > > > @@ -2989,7 +2994,7 @@ sub process { > > > } > > > > > > # Check the patch for a signoff: > > > - if ($line =~ /^\s*signed-off-by:\s*(.*)/i) { > > > + if (!$is_patch && $line =~ /^\s*signed-off-by:\s*(.*)/i) { > > > $signoff++; > > > $in_commit_log = 0; > > > if ($author ne '' && $authorsignoff != 1) { > > > @@ -3028,7 +3033,7 @@ sub process { > > > } > > > > > > # Check for patch separator > > > - if ($line =~ /^---$/) { > > > + if ($line =~ /^---/) { > > > $has_patch_separator = 1; > > > $in_commit_log = 0; > > > } > > > -- > > > 2.52.0.223.gf5cc29aaa4-goog > > > > > > ^ permalink raw reply [flat|nested] 15+ messages in thread
[parent not found: <195a2cba2b461a0ab99ae004bdf079b038db8b07.camel@perches.com>]
* Re: [PATCH v1] checkpatch: Warn about sign offs if there's an accidental patch separator [not found] ` <195a2cba2b461a0ab99ae004bdf079b038db8b07.camel@perches.com> @ 2026-01-04 21:13 ` Ian Rogers 2026-01-04 22:22 ` Joe Perches 0 siblings, 1 reply; 15+ messages in thread From: Ian Rogers @ 2026-01-04 21:13 UTC (permalink / raw) To: Joe Perches, Andrew Morton Cc: Kuan-Wei Chiu, Dwaipayan Ray, Lukas Bulwahn, Stephen Rothwell, Andy Whitcroft, linux-kernel, Namhyung Kim On Sun, Jan 4, 2026 at 10:54 AM Joe Perches <joe@perches.com> wrote: > > On Mon, 2026-01-05 at 01:37 +0800, Kuan-Wei Chiu wrote: > > +Cc Andrew Morton, > [] > > > That said, any Ack/Review or feedback from checkpatch.pl > > maintainers/reviewers would still be helpful and appreciated. > > > I think most of this is pointless and incorrect besides. > A patch separator is specifically 3 dashes not a line that > starts with 3 or more dashes. Thanks Joe, do you have a reference for this? I was going off-of git's behavior and I think the commit message covers that this patch is fixing checkpatch.pl's behavior to match that of git's wrt lines starting '---'. Or are you saying that git is broken and we should patch git? In this case it would still be a useful lint test for checkpatch.pl to warn about the '---' behavior for old versions of git - at some future date when all gits have the patch then the checkpatch.pl behavior can switch from '^---' to '^---$' again. In summary, I think it is still the right thing for this patch to be carried unless you have other concerns - could you be more specific on what you mean by "most of this". Thanks, Ian > See the original problem > https://lore.kernel.org/lkml/20251203214706.112174-7-irogers@google.com/ ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v1] checkpatch: Warn about sign offs if there's an accidental patch separator 2026-01-04 21:13 ` Ian Rogers @ 2026-01-04 22:22 ` Joe Perches 2026-01-05 15:39 ` Ian Rogers 0 siblings, 1 reply; 15+ messages in thread From: Joe Perches @ 2026-01-04 22:22 UTC (permalink / raw) To: Ian Rogers, Andrew Morton Cc: Kuan-Wei Chiu, Dwaipayan Ray, Lukas Bulwahn, Stephen Rothwell, Andy Whitcroft, linux-kernel, Namhyung Kim On Sun, 2026-01-04 at 13:13 -0800, Ian Rogers wrote: > On Sun, Jan 4, 2026 at 10:54 AM Joe Perches <joe@perches.com> wrote: > > > > On Mon, 2026-01-05 at 01:37 +0800, Kuan-Wei Chiu wrote: > > > +Cc Andrew Morton, > > [] > > > > > That said, any Ack/Review or feedback from checkpatch.pl > > > maintainers/reviewers would still be helpful and appreciated. > > > > > > I think most of this is pointless and incorrect besides. > > A patch separator is specifically 3 dashes not a line that > > starts with 3 or more dashes. > > Thanks Joe, do you have a reference for this? [] > > See the original problem > > https://lore.kernel.org/lkml/20251203214706.112174-7-irogers@google.com/ Did you look at this? ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v1] checkpatch: Warn about sign offs if there's an accidental patch separator 2026-01-04 22:22 ` Joe Perches @ 2026-01-05 15:39 ` Ian Rogers 2026-01-05 16:46 ` Joe Perches 0 siblings, 1 reply; 15+ messages in thread From: Ian Rogers @ 2026-01-05 15:39 UTC (permalink / raw) To: Joe Perches, Andrew Morton Cc: Kuan-Wei Chiu, Dwaipayan Ray, Lukas Bulwahn, Stephen Rothwell, Andy Whitcroft, linux-kernel, Namhyung Kim On Sun, Jan 4, 2026 at 2:22 PM Joe Perches <joe@perches.com> wrote: > > On Sun, 2026-01-04 at 13:13 -0800, Ian Rogers wrote: > > On Sun, Jan 4, 2026 at 10:54 AM Joe Perches <joe@perches.com> wrote: > > > > > > On Mon, 2026-01-05 at 01:37 +0800, Kuan-Wei Chiu wrote: > > > > +Cc Andrew Morton, > > > [] > > > > > > > That said, any Ack/Review or feedback from checkpatch.pl > > > > maintainers/reviewers would still be helpful and appreciated. > > > > > > > > > I think most of this is pointless and incorrect besides. > > > A patch separator is specifically 3 dashes not a line that > > > starts with 3 or more dashes. > > > > Thanks Joe, do you have a reference for this? > [] > > > See the original problem > > > https://lore.kernel.org/lkml/20251203214706.112174-7-irogers@google.com/ > > Did you look at this? I was the author of it. The patch passed checkpatch.pl but then created a commit with missing tags - ie it was broken. This patch is fixing this issue so that checkpatch.pl will warn about the missing tags prior to the patch being sent to LKML, which is kind of checkpatch.pl's purpose. This is all detailed in the commit message. Thanks, Ian Rogers ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v1] checkpatch: Warn about sign offs if there's an accidental patch separator 2026-01-05 15:39 ` Ian Rogers @ 2026-01-05 16:46 ` Joe Perches 2026-01-05 17:13 ` Ian Rogers 0 siblings, 1 reply; 15+ messages in thread From: Joe Perches @ 2026-01-05 16:46 UTC (permalink / raw) To: Ian Rogers, Andrew Morton Cc: Kuan-Wei Chiu, Dwaipayan Ray, Lukas Bulwahn, Stephen Rothwell, Andy Whitcroft, linux-kernel, Namhyung Kim On Mon, 2026-01-05 at 07:39 -0800, Ian Rogers wrote: > I was the author of it. The patch passed checkpatch.pl but then > created a commit with missing tags - ie it was broken. This patch is > fixing this issue so that checkpatch.pl will warn about the missing > tags prior to the patch being sent to LKML, which is kind of > checkpatch.pl's purpose. This is all detailed in the commit message. Whatever was the tool that applied the patch should be fixed instead. ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v1] checkpatch: Warn about sign offs if there's an accidental patch separator 2026-01-05 16:46 ` Joe Perches @ 2026-01-05 17:13 ` Ian Rogers 2026-01-14 3:33 ` Andrew Morton 0 siblings, 1 reply; 15+ messages in thread From: Ian Rogers @ 2026-01-05 17:13 UTC (permalink / raw) To: Joe Perches Cc: Andrew Morton, Kuan-Wei Chiu, Dwaipayan Ray, Lukas Bulwahn, Stephen Rothwell, Andy Whitcroft, linux-kernel, Namhyung Kim On Mon, Jan 5, 2026 at 8:46 AM Joe Perches <joe@perches.com> wrote: > > On Mon, 2026-01-05 at 07:39 -0800, Ian Rogers wrote: > > I was the author of it. The patch passed checkpatch.pl but then > > created a commit with missing tags - ie it was broken. This patch is > > fixing this issue so that checkpatch.pl will warn about the missing > > tags prior to the patch being sent to LKML, which is kind of > > checkpatch.pl's purpose. This is all detailed in the commit message. > > Whatever was the tool that applied the patch should be fixed instead. The tool was git. As I mentioned, we can patch git but old versions will still have the '^---' rather than '^---$' behavior and so these checkpatch.pl tests remain useful. Thanks, Ian ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v1] checkpatch: Warn about sign offs if there's an accidental patch separator 2026-01-05 17:13 ` Ian Rogers @ 2026-01-14 3:33 ` Andrew Morton 2026-01-14 5:29 ` Stephen Rothwell ` (2 more replies) 0 siblings, 3 replies; 15+ messages in thread From: Andrew Morton @ 2026-01-14 3:33 UTC (permalink / raw) To: Ian Rogers Cc: Joe Perches, Kuan-Wei Chiu, Dwaipayan Ray, Lukas Bulwahn, Stephen Rothwell, Andy Whitcroft, linux-kernel, Namhyung Kim On Mon, 5 Jan 2026 09:13:49 -0800 Ian Rogers <irogers@google.com> wrote: > On Mon, Jan 5, 2026 at 8:46 AM Joe Perches <joe@perches.com> wrote: > > > > On Mon, 2026-01-05 at 07:39 -0800, Ian Rogers wrote: > > > I was the author of it. The patch passed checkpatch.pl but then > > > created a commit with missing tags - ie it was broken. This patch is > > > fixing this issue so that checkpatch.pl will warn about the missing > > > tags prior to the patch being sent to LKML, which is kind of > > > checkpatch.pl's purpose. This is all detailed in the commit message. > > > > Whatever was the tool that applied the patch should be fixed instead. > > The tool was git. As I mentioned, we can patch git but old versions > will still have the '^---' rather than '^---$' behavior and so these > checkpatch.pl tests remain useful. > I was bitten by this recently. Someone's changelog had ----------- stuff here and git-quiltimport remove half the changelog and all the metadata. git is wrong. I say so coz I invented the --- convention. submitting-patches.rst says - A marker line containing simply ``---``. The astonishingly old https://www.ozlabs.org/~akpm/stuff/tpp.txt says "... scripts will treat a ^--- string as ...". I regret not explicitly using "^---$". I'd like checkpatch to emit a warning in this case. If a line starts with --- then please let's warn the user that downstream tooling will screw this up. ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v1] checkpatch: Warn about sign offs if there's an accidental patch separator 2026-01-14 3:33 ` Andrew Morton @ 2026-01-14 5:29 ` Stephen Rothwell 2026-01-14 18:20 ` Joe Perches 2026-01-16 17:42 ` [PATCH] checkpatch: Add an invalid patch separator test Joe Perches 2 siblings, 0 replies; 15+ messages in thread From: Stephen Rothwell @ 2026-01-14 5:29 UTC (permalink / raw) To: Andrew Morton Cc: Ian Rogers, Joe Perches, Kuan-Wei Chiu, Dwaipayan Ray, Lukas Bulwahn, Andy Whitcroft, linux-kernel, Namhyung Kim [-- Attachment #1: Type: text/plain, Size: 786 bytes --] Hi Andrew, On Tue, 13 Jan 2026 19:33:19 -0800 Andrew Morton <akpm@linux-foundation.org> wrote: > > git is wrong. I say so coz I invented the --- convention. > submitting-patches.rst says > > - A marker line containing simply ``---``. > > The astonishingly old https://www.ozlabs.org/~akpm/stuff/tpp.txt says > "... scripts will treat a ^--- string as ...". I regret not > explicitly using "^---$". > > I'd like checkpatch to emit a warning in this case. If a line starts > with --- then please let's warn the user that downstream tooling will > screw this up. https://en.wikipedia.org/wiki/Signature_block#Standard_delimiter I have used dash-dash-space for as long as I can remember (which varies these days ;-) ). -- Cheers, Stephen Rothwell [-- Attachment #2: OpenPGP digital signature --] [-- Type: application/pgp-signature, Size: 488 bytes --] ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v1] checkpatch: Warn about sign offs if there's an accidental patch separator 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 ` [PATCH] checkpatch: Add an invalid patch separator test Joe Perches 2 siblings, 1 reply; 15+ messages in thread From: Joe Perches @ 2026-01-14 18:20 UTC (permalink / raw) To: Andrew Morton, Ian Rogers Cc: Kuan-Wei Chiu, Dwaipayan Ray, Lukas Bulwahn, Stephen Rothwell, Andy Whitcroft, linux-kernel, Namhyung Kim On Tue, 2026-01-13 at 19:33 -0800, Andrew Morton wrote: > I was bitten by this recently. Someone's changelog had > > ----------- stuff here > > and git-quiltimport remove half the changelog and all the metadata. > > git is wrong. I say so coz I invented the --- convention. > submitting-patches.rst says > > - A marker line containing simply ``---``. > > The astonishingly old https://www.ozlabs.org/~akpm/stuff/tpp.txt says > "... scripts will treat a ^--- string as ...". I regret not > explicitly using "^---$". > > I'd like checkpatch to emit a warning in this case. If a line starts > with --- then please let's warn the user that downstream tooling will > screw this up. Maybe something like this: --- scripts/checkpatch.pl | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index e0f1d6a6bc636..8dd58710302bc 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -3035,6 +3035,14 @@ sub process { } } +# Check for invalid patch separator + if ($in_commit_log && + $line =~ /^---.+/) { + ERROR("BAD_PATCH_SEPARATOR", + "Invalid patch separator - some tools may have problems applying this\n" . $herecurr) + } + + # Check for patch separator if ($line =~ /^---$/) { $has_patch_separator = 1; ^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: [PATCH v1] checkpatch: Warn about sign offs if there's an accidental patch separator 2026-01-14 18:20 ` Joe Perches @ 2026-01-14 19:01 ` Ian Rogers 0 siblings, 0 replies; 15+ messages in thread From: Ian Rogers @ 2026-01-14 19:01 UTC (permalink / raw) To: Joe Perches Cc: Andrew Morton, Kuan-Wei Chiu, Dwaipayan Ray, Lukas Bulwahn, Stephen Rothwell, Andy Whitcroft, linux-kernel, Namhyung Kim On Wed, Jan 14, 2026 at 10:20 AM Joe Perches <joe@perches.com> wrote: > > On Tue, 2026-01-13 at 19:33 -0800, Andrew Morton wrote: > > I was bitten by this recently. Someone's changelog had > > > > ----------- stuff here > > > > and git-quiltimport remove half the changelog and all the metadata. > > > > git is wrong. I say so coz I invented the --- convention. > > submitting-patches.rst says > > > > - A marker line containing simply ``---``. > > > > The astonishingly old https://www.ozlabs.org/~akpm/stuff/tpp.txt says > > "... scripts will treat a ^--- string as ...". I regret not > > explicitly using "^---$". > > > > I'd like checkpatch to emit a warning in this case. If a line starts > > with --- then please let's warn the user that downstream tooling will > > screw this up. > > Maybe something like this: > --- > scripts/checkpatch.pl | 8 ++++++++ > 1 file changed, 8 insertions(+) > > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl > index e0f1d6a6bc636..8dd58710302bc 100755 > --- a/scripts/checkpatch.pl > +++ b/scripts/checkpatch.pl > @@ -3035,6 +3035,14 @@ sub process { > } > } > > +# Check for invalid patch separator > + if ($in_commit_log && > + $line =~ /^---.+/) { > + ERROR("BAD_PATCH_SEPARATOR", > + "Invalid patch separator - some tools may have problems applying this\n" . $herecurr) > + } > + > + > # Check for patch separator > if ($line =~ /^---$/) { > $has_patch_separator = 1; Sgtm, it still seems potentially error prone that sign offs are counted even when not in the commit message. ie this bit of this patch: ``` # Check the patch for a signoff: - if ($line =~ /^\s*signed-off-by:\s*(.*)/i) { + if (!$is_patch && $line =~ /^\s*signed-off-by:\s*(.*)/i) { $signoff++; $in_commit_log = 0; if ($author ne '' && $authorsignoff != 1) { ``` Thanks, Ian ^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH] checkpatch: Add an invalid patch separator test 2026-01-14 3:33 ` Andrew Morton 2026-01-14 5:29 ` Stephen Rothwell 2026-01-14 18:20 ` Joe Perches @ 2026-01-16 17:42 ` Joe Perches 2026-01-16 20:48 ` Andrew Morton 2 siblings, 1 reply; 15+ messages in thread From: Joe Perches @ 2026-01-16 17:42 UTC (permalink / raw) To: Andrew Morton, Ian Rogers Cc: Kuan-Wei Chiu, Dwaipayan Ray, Lukas Bulwahn, Stephen Rothwell, Andy Whitcroft, linux-kernel, Namhyung Kim 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; ^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: [PATCH] checkpatch: Add an invalid patch separator test 2026-01-16 17:42 ` [PATCH] checkpatch: Add an invalid patch separator test Joe Perches @ 2026-01-16 20:48 ` Andrew Morton 0 siblings, 0 replies; 15+ messages in thread From: Andrew Morton @ 2026-01-16 20:48 UTC (permalink / raw) To: Joe Perches Cc: Ian Rogers, Kuan-Wei Chiu, Dwaipayan Ray, Lukas Bulwahn, Stephen Rothwell, Andy Whitcroft, linux-kernel, Namhyung Kim On Fri, 16 Jan 2026 09:42:52 -0800 Joe Perches <joe@perches.com> wrote: > 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. > lgtm, thanks. I think Suggested-by:Ian is appropriate. ^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2026-01-16 20:48 UTC | newest]
Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 ` [PATCH] checkpatch: Add an invalid patch separator test Joe Perches
2026-01-16 20:48 ` Andrew Morton
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.