[PATCH 1/2] checkpatch: allow special characters in spelling.txt

From: Heinrich Schuchardt
Date: Sat Dec 14 2024 - 21:52:23 EST


Checkpatch.pl uses the misspelled words from spelling.txt both as keys of a
hash and as part of a regular expression. For usage in the regular
expression special characters like the plus sign need to be escaped.

Escape special characters in the list of misspelled words.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@xxxxxxxxxxxxx>
---
scripts/checkpatch.pl | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 744328d21eb8..572411aaa4be 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -978,7 +978,7 @@ if ($codespell) {
}
}

-$misspellings = join("|", sort keys %spelling_fix) if keys %spelling_fix;
+$misspellings = join("|", map{quotemeta($_)} sort keys %spelling_fix) if keys %spelling_fix;

sub read_words {
my ($wordsRef, $file) = @_;
--
2.45.2