* [PATCH] checkpatch: Fix unescaped left brace
@ 2020-11-15 20:29 Dwaipayan Ray
2020-11-16 3:43 ` Joe Perches
0 siblings, 1 reply; 5+ messages in thread
From: Dwaipayan Ray @ 2020-11-15 20:29 UTC (permalink / raw)
To: joe; +Cc: linux-kernel-mentees, dwaipayanray1, linux-kernel, lukas.bulwahn
There is an unescaped left brace in a regex in OPEN_BRACE
check. This throws a runtime error when checkpatch is run
with --fix flag and the OPEN_BRACE check is executed.
Fix it by escaping the left brace.
Fixes: 8d1824780f2f ("checkpatch: add --fix option for a couple OPEN_BRACE misuses")
Signed-off-by: Dwaipayan Ray <dwaipayanray1@gmail.com>
---
scripts/checkpatch.pl | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 2749f32dffe9..0da6422cd0fd 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -4505,7 +4505,7 @@ sub process {
$fix) {
fix_delete_line($fixlinenr, $rawline);
my $fixed_line = $rawline;
- $fixed_line =~ /(^..*$Type\s*$Ident\(.*\)\s*){(.*)$/;
+ $fixed_line =~ /(^..*$Type\s*$Ident\(.*\)\s*)\{(.*)$/;
my $line1 = $1;
my $line2 = $2;
fix_insert_line($fixlinenr, ltrim($line1));
--
2.27.0
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] checkpatch: Fix unescaped left brace
2020-11-15 20:29 [PATCH] checkpatch: Fix unescaped left brace Dwaipayan Ray
@ 2020-11-16 3:43 ` Joe Perches
2020-11-16 23:02 ` Joe Perches
0 siblings, 1 reply; 5+ messages in thread
From: Joe Perches @ 2020-11-16 3:43 UTC (permalink / raw)
To: Dwaipayan Ray, Andrew Morton
Cc: linux-kernel-mentees, linux-kernel, lukas.bulwahn
On Mon, 2020-11-16 at 01:59 +0530, Dwaipayan Ray wrote:
> There is an unescaped left brace in a regex in OPEN_BRACE
> check. This throws a runtime error when checkpatch is run
> with --fix flag and the OPEN_BRACE check is executed.
>
> Fix it by escaping the left brace.
>
> Fixes: 8d1824780f2f ("checkpatch: add --fix option for a couple OPEN_BRACE misuses")
> Signed-off-by: Dwaipayan Ray <dwaipayanray1@gmail.com>
Thanks Dwaipayan.
Obviously that code path hasn't been tested in awhile.
I think the notice to require an escape for a { was added back in
perl 5.16 or so.
Acked-by: Joe Perches <joe@perches.com>
> ---
> scripts/checkpatch.pl | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index 2749f32dffe9..0da6422cd0fd 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -4505,7 +4505,7 @@ sub process {
> $fix) {
> fix_delete_line($fixlinenr, $rawline);
> my $fixed_line = $rawline;
> - $fixed_line =~ /(^..*$Type\s*$Ident\(.*\)\s*){(.*)$/;
> + $fixed_line =~ /(^..*$Type\s*$Ident\(.*\)\s*)\{(.*)$/;
> my $line1 = $1;
> my $line2 = $2;
> fix_insert_line($fixlinenr, ltrim($line1));
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] checkpatch: Fix unescaped left brace
2020-11-16 3:43 ` Joe Perches
@ 2020-11-16 23:02 ` Joe Perches
2020-11-17 9:07 ` Dwaipayan Ray
0 siblings, 1 reply; 5+ messages in thread
From: Joe Perches @ 2020-11-16 23:02 UTC (permalink / raw)
To: Dwaipayan Ray, Andrew Morton
Cc: linux-kernel-mentees, linux-kernel, lukas.bulwahn
On Sun, 2020-11-15 at 19:43 -0800, Joe Perches wrote:
> On Mon, 2020-11-16 at 01:59 +0530, Dwaipayan Ray wrote:
> > There is an unescaped left brace in a regex in OPEN_BRACE
> > check. This throws a runtime error when checkpatch is run
> > with --fix flag and the OPEN_BRACE check is executed.
> >
> > Fix it by escaping the left brace.
> >
> > Fixes: 8d1824780f2f ("checkpatch: add --fix option for a couple OPEN_BRACE misuses")
> > Signed-off-by: Dwaipayan Ray <dwaipayanray1@gmail.com>
>
> Thanks Dwaipayan.
>
> Obviously that code path hasn't been tested in awhile.
>
> I think the notice to require an escape for a { was added back in
> perl 5.16 or so.
Just fyi: it seems the requirement was actually implemented in perl 5.22
and this code predates the release of perl 5.22
https://github.com/Perl/perl5/blob/blead/pod/perl5220delta.pod
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] checkpatch: Fix unescaped left brace
2020-11-16 23:02 ` Joe Perches
@ 2020-11-17 9:07 ` Dwaipayan Ray
2020-11-17 16:04 ` Joe Perches
0 siblings, 1 reply; 5+ messages in thread
From: Dwaipayan Ray @ 2020-11-17 9:07 UTC (permalink / raw)
To: Joe Perches, linux-kernel-mentees, Lukas Bulwahn, linux-kernel
On Tue, Nov 17, 2020 at 4:32 AM Joe Perches <joe@perches.com> wrote:
>
> On Sun, 2020-11-15 at 19:43 -0800, Joe Perches wrote:
> > On Mon, 2020-11-16 at 01:59 +0530, Dwaipayan Ray wrote:
> > > There is an unescaped left brace in a regex in OPEN_BRACE
> > > check. This throws a runtime error when checkpatch is run
> > > with --fix flag and the OPEN_BRACE check is executed.
> > >
> > > Fix it by escaping the left brace.
> > >
> > > Fixes: 8d1824780f2f ("checkpatch: add --fix option for a couple OPEN_BRACE misuses")
> > > Signed-off-by: Dwaipayan Ray <dwaipayanray1@gmail.com>
> >
> > Thanks Dwaipayan.
> >
> > Obviously that code path hasn't been tested in awhile.
> >
> > I think the notice to require an escape for a { was added back in
> > perl 5.16 or so.
>
> Just fyi: it seems the requirement was actually implemented in perl 5.22
> and this code predates the release of perl 5.22
>
> https://github.com/Perl/perl5/blob/blead/pod/perl5220delta.pod
>
That's pretty interesting. Apart from that I have seen that
the perl_version_ok check mandates perl 5.10 which was
released more than 10 years back.
Do you think that check could be removed completely?
Maybe sometime in the future or just have it lay around
for backward compatibility?
Thanks,
Dwaipayan.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] checkpatch: Fix unescaped left brace
2020-11-17 9:07 ` Dwaipayan Ray
@ 2020-11-17 16:04 ` Joe Perches
0 siblings, 0 replies; 5+ messages in thread
From: Joe Perches @ 2020-11-17 16:04 UTC (permalink / raw)
To: Dwaipayan Ray, linux-kernel-mentees, Lukas Bulwahn, linux-kernel
On Tue, 2020-11-17 at 14:37 +0530, Dwaipayan Ray wrote:
> I have seen that
> the perl_version_ok check mandates perl 5.10 which was
> released more than 10 years back.
>
> Do you think that check could be removed completely?
> Maybe sometime in the future or just have it lay around
> for backward compatibility?
I think having the check in the code isn't burdensome.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2020-11-17 16:04 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-15 20:29 [PATCH] checkpatch: Fix unescaped left brace Dwaipayan Ray
2020-11-16 3:43 ` Joe Perches
2020-11-16 23:02 ` Joe Perches
2020-11-17 9:07 ` Dwaipayan Ray
2020-11-17 16:04 ` Joe Perches
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®