[Linux-kernel-mentees] [PATCH] checkpatch: Adjust spelling check false positive
mrinalmni at gmail.com
Sat Jul 11 13:37:06 UTC 2020
On Sat, Jul 11, 2020 at 3:01 AM Lukas Bulwahn <lukas.bulwahn at gmail.com>
> >> For Issue 6: Can you provide me the commit hash that caused this
> >> checkpatch.pl error? Then, we can reproduce and confirm that issue
> >> probably simply with `git format-patch -1 $SHA |
> >> ./scripts/checkpatch.pl` and observe the bug and crash ourselves?
> > These are the commit hashes that crashed the checkpatch:
> > 6b3e0e2e0461
> > 19ce2321739d
> > 059c6d68cfc5
> Okay, I checked the output of checkpatch.pl on those three commits and
> I can confirm that checkpatch.pl warns during its own execution with:
> Use of uninitialized value $1 in regexp compilation at
> ./scripts/checkpatch.pl line 2638.
> Mrinal, can you debug and find out why and what specifically in those
> patches cause this warning in line 2638?
The block in checkpatch where this issue appears is triggered only when
writes a commit message that contains diff content. This is a rare event
hence the issue
in the block shows up only for a few specific commits.
> Also, what is the intent and when was this introduced to
> checkpatch.pl? It could be that it never worked since it was
> introduced or that it broke due to some refactoring. Can you find what
> happened in this case here?
The code which causes the issue is:
$line =~ m@^\s+diff\b.*a/[\w/]+@ && $line =~ m@
I believe the intent was to use the "capture groups ( ... )" of Perl and
then use `$1`, which
would have contained the previous match, in the regex expression. Somehow,
group is used in the same expression as `$1` leading `$1` to remain
uninitialized, i.e. ([\w/]+) followed by $1.
In my opinion, the ( ... ) should be used in the previous expression
thereby initializing `$1` to the required value.
When I do this change and run the script again, the error vanishes.
Please let me know if what I say sounds reasonable so that I will continue
with sending this patch to you.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Linux-kernel-mentees