The current code that checks for misspelling verifies, in a more complex regex, if $rawline matches [^\w]($misspellings)[^\w] Being $rawline a byte-string, a utf-8 character in $rawline can match the non-word-char [^\w]. E.g.: ./scripts/checkpatch.pl --git 81c2f059ab9 WARNING: 'ment' may be misspelled - perhaps 'meant'? #36: FILE: MAINTAINERS:14360: +M: Clément Léger <clement.leger@bootlin.com> ^^^^ Use a utf-8 version of $rawline for spell checking.
Showing the changes to scripts/checkpatch.pl (1 of 1 file). Show all
Unified · Split
| @@ -3502,9 +3502,10 @@ sub process { · 3501 unmodified lines | ||
| 3502 | 3502 | # Check for various typo / spelling mistakes |
| 3503 | 3503 | if (defined($misspellings) && |
| 3504 | 3504 | ($in_commit_log || $line =~ /^(?:\+|Subject:)/i)) { |
| 3505 | − while ($rawline =~ /(?:^|[^\w\-'`])($misspellings)(?:[^\w\-'`]|$)/gi) { | |
| 3505 | + my $rawline_utf8 = decode("utf8", $rawline); | |
| 3506 | + while ($rawline_utf8 =~ /(?:^|[^\w\-'`])($misspellings)(?:[^\w\-'`]|$)/gi) { | |
| 3506 | 3507 | my $typo = $1; |
| 3507 | − my $blank = copy_spacing($rawline); | |
| 3508 | + my $blank = copy_spacing($rawline_utf8); | |
| 3508 | 3509 | my $ptr = substr($blank, 0, $-[1]) . "^" x length($typo); |
| 3509 | 3510 | my $hereptr = "$hereline$ptr\n"; |
| 3510 | 3511 | my $typo_fix = $spelling_fix{lc($typo)}; |