Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

checkpatch: use utf-8 match for spell checking

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.

Link: https://lkml.kernel.org/r/20250616-b4-checkpatch-upstream-v2-1-5600ce4a3b43@foss.st.com
Signed-off-by: Antonio Borneo <antonio.borneo@foss.st.com>
Signed-off-by: Clément Le Goffic <clement.legoffic@foss.st.com>
Cc: Andy Whitcroft <apw@canonical.com>
Cc: Dwaipayan Ray <dwaipayanray1@gmail.com>
Cc: Joe Perches <joe@perches.com>
Cc: Lukas Bulwahn <lukas.bulwahn@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Antonio Borneo and committed by
Andrew Morton
5eee4c2b e795000e

+3 -2
+3 -2
scripts/checkpatch.pl
··· 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)};