checkpatch: Fix unescaped left brace
PATCH 1/1 checkpatch: Fix unescaped left brace
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.
--- scripts/checkpatch.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/checkpatch.pl +1 -1
@@ -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));
Signature · 6 lines
2.27.0 _______________________________________________ Linux-kernel-mentees mailing list [email protected] https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees
Quoted 8 lines · Dwaipayan Ray
There is an unescaped left brace in a regex in
OPEN_BRACEcheck. This throws a runtime error when checkpatch is run with --fix flag and theOPEN_BRACEcheck 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 <[email protected]>
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.
Quoted 17 lines
---
scripts/checkpatch.pl | 2 +-1 file changed, 1 insertion(+), 1 deletion(-)scripts/checkpatch.pl +1
-1@@ -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));
Joe Perches
maintainerQuoted 10 lines · Joe Perches
Quoted 8 lines · Dwaipayan Ray
There is an unescaped left brace in a regex in
OPEN_BRACEcheck. This throws a runtime error when checkpatch is run with --fix flag and theOPEN_BRACEcheck 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 <[email protected]>
Quoted 6 lines
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
_______________________________________________
Linux-kernel-mentees mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees
Quoted 16 lines · Joe Perches
Quoted 14 lines · Joe Perches
Quoted 8 lines · Dwaipayan Ray
There is an unescaped left brace in a regex in
OPEN_BRACEcheck. This throws a runtime error when checkpatch is run with --fix flag and theOPEN_BRACEcheck 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 <[email protected]>Thanks Dwaipayan.
Obviously that code path hasn't been tested in awhile.
Quoted 8 lines
Quoted 2 lines
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.
_______________________________________________
Linux-kernel-mentees mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees
Joe Perches
maintainerQuoted 7 lines · Dwaipayan Ray
I have seen that
theperl_version_okcheck 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.
_______________________________________________
Linux-kernel-mentees mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees