linux-kernel-mentees.lists.linuxfoundation.org archive mirror
 help / color / mirror / Atom feed
From: Mrinal Pandey <mrinalmni@gmail.com>
To: Lukas Bulwahn <lukas.bulwahn@gmail.com>,
	Shuah Khan <skhan@linuxfoundation.org>,
	 Linux-kernel-mentees@lists.linuxfoundation.org
Subject: Re: [Linux-kernel-mentees] [PATCH] checkpatch: Adjust spelling check false positive
Date: Sat, 11 Jul 2020 19:07:06 +0530	[thread overview]
Message-ID: <CAD1=X6nPM2MXf3C1BUHQei57k=Nn481GRRrB3agR5vUXfDoUOg@mail.gmail.com> (raw)
In-Reply-To: <CAKXUXMzFHnW5Yn5gwXgh3YtwCWfhFjeucMV4-JvX--2rFkFirg@mail.gmail.com>


[-- Attachment #1.1: Type: text/plain, Size: 2017 bytes --]

On Sat, Jul 11, 2020 at 3:01 AM Lukas Bulwahn <lukas.bulwahn@gmail.com>
wrote:

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

Sir,

The block in checkpatch where this issue appears is triggered only when
someone
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@
^\s+diff\b.*a/([\w/]+)\s+b/$1\b@

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,
the capture
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.

>
> Lukas
>

[-- Attachment #1.2: Type: text/html, Size: 3302 bytes --]

[-- Attachment #2: Type: text/plain, Size: 201 bytes --]

_______________________________________________
Linux-kernel-mentees mailing list
Linux-kernel-mentees@lists.linuxfoundation.org
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees

  reply	other threads:[~2020-07-11 13:37 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-06  8:08 Mrinal Pandey
2020-07-06 19:50 ` Lukas Bulwahn
     [not found]   ` <CAD1=X6m06KWb3=VEGkFWpmmV=UC09ZYbj2qpAOyg6OPFM=8KqA@mail.gmail.com>
     [not found]     ` <CAKXUXMy_KAHn+FNWviazVcEqK213uLVksq8_8HhjXAW+_OBrzQ@mail.gmail.com>
     [not found]       ` <CAD1=X6==MgT6jaNZ9PsPUqV1QTRFKguq9zvV+TtFSHyajFMjUg@mail.gmail.com>
2020-07-09  5:03         ` Lukas Bulwahn
2020-07-10 11:26           ` Mrinal Pandey
2020-07-10 20:46             ` Shuah Khan
2020-07-10 21:15               ` Lukas Bulwahn
2020-07-11 13:40                 ` Mrinal Pandey
2020-07-10 21:31             ` Lukas Bulwahn
2020-07-11 13:37               ` Mrinal Pandey [this message]
2020-07-10 21:47             ` Lukas Bulwahn
2020-07-14 14:56               ` Mrinal Pandey
2020-07-15  5:32                 ` Lukas Bulwahn
2020-07-18  7:00                   ` Mrinal Pandey

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='CAD1=X6nPM2MXf3C1BUHQei57k=Nn481GRRrB3agR5vUXfDoUOg@mail.gmail.com' \
    --to=mrinalmni@gmail.com \
    --cc=Linux-kernel-mentees@lists.linuxfoundation.org \
    --cc=lukas.bulwahn@gmail.com \
    --cc=skhan@linuxfoundation.org \
    --subject='Re: [Linux-kernel-mentees] [PATCH] checkpatch: Adjust spelling check false positive' \
    /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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).