Re: [PATCH v7] checkpatch: warn for non-standard fixes tag style

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxx/
> 
> 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



[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux