mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Kuan-Wei Chiu <visitorckw@gmail.com>
To: Ian Rogers <irogers@google.com>
Cc: Dwaipayan Ray <dwaipayanray1@gmail.com>,
	Lukas Bulwahn <lukas.bulwahn@gmail.com>,
	Stephen Rothwell <sfr@canb.auug.org.au>,
	Andy Whitcroft <apw@canonical.com>, Joe Perches <joe@perches.com>,
	linux-kernel@vger.kernel.org, Namhyung Kim <namhyung@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH v1] checkpatch: Warn about sign offs if there's an accidental patch separator
Date: Mon, 5 Jan 2026 01:37:26 +0800	[thread overview]
Message-ID: <aVqlVgji7TU9tiSz@google.com> (raw)
In-Reply-To: <CAP-5=fU=rzQgjKW4kxQGmhpBq1FCTawVNECOXmU5U3bntcc-Vg@mail.gmail.com>

+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
> > >
> > >

  reply	other threads:[~2026-01-04 17:37 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-05  5:34 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 [this message]
     [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

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

Powered by JetHome