Linux Documentation
 help / color / mirror / Atom feed
From: "Niklas Söderlund" <niklas.soderlund@corigine.com>
To: Joe Perches <joe@perches.com>
Cc: Dwaipayan Ray <dwaipayanray1@gmail.com>,
	Lukas Bulwahn <lukas.bulwahn@gmail.com>,
	Jonathan Corbet <corbet@lwn.net>,
	Andy Whitcroft <apw@canonical.com>,
	linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,
	Philippe Schenker <philippe.schenker@toradex.com>,
	Stephen Rothwell <sfr@canb.auug.org.au>,
	oss-drivers@corigine.com,
	Simon Horman <simon.horman@corigine.com>,
	Louis Peens <louis.peens@corigine.com>
Subject: Re: [PATCH v7] checkpatch: warn for non-standard fixes tag style
Date: Thu, 15 Sep 2022 11:14:59 +0200	[thread overview]
Message-ID: <YyLtEza0VhSbflvH@oden.dyn.berto.se> (raw)
In-Reply-To: <aa858ac592679fdf512debe17e0612c575450860.camel@perches.com>

Hi Joe,

On 2022-09-14 09:09:25 -0700, Joe Perches wrote:
> On Wed, 2022-09-14 at 12:02 +0200, Niklas Söderlund wrote:
> > Add a warning for fixes tags that does not follow community conventions.
> []
> > * Changes since v6
> > - Update first check to make sure that there is a likely SHA1 of some
> >   minimum length after the fixes line.
> 
> https://lore.kernel.org/lkml/2febb7893346b6234983453de7c037536e479bfc.camel@perches.com/
> 
> The goal here should be to identify a line that looks like a commit
> reference.
> 
> So find lines that starts with 'fixes' and have a SHA1 commit id as
> broadly as reasonable.
> 
> Did you run the grep pattern and look at the results?
> 
> One grep pattern to verify the non canonical fixes format that
> are mistakenly used is:
> 
> $ git log --since=5-years-ago --no-merges --grep='^\s*fixes' -i --format=email -P | \
>   grep -P -i '^\s*fixes' | \
>   grep -P -v '^Fixes: [0-9a-f]{12,12}\s*\(".*")'
> 
> []
> 
> There are many different styles.
> Parenthesea are sometimes not used.

I understand this, and I did have a look at it.

> 
> > +			if ($line =~ /(\s*fixes:?)\s+([0-9a-f]{5,})\s+($balanced_parens)/i) {
> 
> How about some pattern like
> 
> 	/fixes\s*:?\s*(?:commit:?\s*)?[0-9a-f]{5,}/i
> 
> or maybe even more broadly:
> 
> 	/fixes\b.*\b[0-9a-f]{5,}\b/i

Maybe I misunderstand your comment, but this is what I do in this patch?

    if (!$in_header_lines &&
        $line =~ /^\s*fixes:?\s*(?:commit\s*)?[0-9a-f]{5,}\b/i) {

        ...

        if ($line =~ /(\s*fixes:?)\s+([0-9a-f]{5,})\s+($balanced_parens)/i) {
            ...
        }
    }

This will catch and warn about such tags but not attempt to break out 
it's components in order to suggest a potentially more correct fix. Is 
it this second filter you would like me to change?

-- 
Kind Regards,
Niklas Söderlund

  reply	other threads:[~2022-09-15  9:16 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-14 10:02 [PATCH v7] checkpatch: warn for non-standard fixes tag style Niklas Söderlund
2022-09-14 16:09 ` Joe Perches
2022-09-15  9:14   ` Niklas Söderlund [this message]
2022-09-21 14:25     ` Niklas Söderlund
2022-09-21 16:56       ` Joe Perches
2022-09-21 16:57 ` Joe Perches

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=YyLtEza0VhSbflvH@oden.dyn.berto.se \
    --to=niklas.soderlund@corigine.com \
    --cc=apw@canonical.com \
    --cc=corbet@lwn.net \
    --cc=dwaipayanray1@gmail.com \
    --cc=joe@perches.com \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=louis.peens@corigine.com \
    --cc=lukas.bulwahn@gmail.com \
    --cc=oss-drivers@corigine.com \
    --cc=philippe.schenker@toradex.com \
    --cc=sfr@canb.auug.org.au \
    --cc=simon.horman@corigine.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