Message ID | 20240102161038.22347-1-antonio.borneo@foss.st.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-14613-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:6f82:b0:100:9c79:88ff with SMTP id tb2csp4559529dyb; Tue, 2 Jan 2024 08:54:57 -0800 (PST) X-Google-Smtp-Source: AGHT+IG4a4ZD7QSmTyc6TR1cQr/67LDpuWRwQwS4I/tDB+S23EtcmAYzsMFfnf082l21qxr6pPR5 X-Received: by 2002:a05:6a20:9385:b0:197:5eb1:2897 with SMTP id x5-20020a056a20938500b001975eb12897mr495039pzh.41.1704214496800; Tue, 02 Jan 2024 08:54:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704214496; cv=none; d=google.com; s=arc-20160816; b=ZVq9comP9o0Q7SaqdPWYd6cGZA6eDtHNZv+5xrf7xuF8AX5qgUHRULbQCuAZKwXhGY CI06yBn3N2eqamvPXLsgHD6JPnvzMeq2qPtIAotMN+0ehYhZSx7kWv+nYfFgqWsHpIZW X2Fr6k4axAeU6tG/yfxmC3Lp9RnSfhYt0cxcjh8xK2cF0KLV4XOJ7q/v1UZ7Af8NNWAx qAnaH1aTm4TOlBzHkA6FfaY/vB+4+ImXQWeI0D8w+5SxhP01MWBxd9BLIbuQZ5x8KpPZ insKngte77ZI65nwD2IgmOLWnc0MfxOWiBndHlvVHCpd6qPMm9q159vv7Ig+p/+dR/4C oHWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=kPETBoGH+akjcEbMQz/7+ofwHwOQ7qKVNhjHOwjNL2A=; fh=bDj0mIoyDvgt+6kb5BvEqQ3di8FOWBb5i2VCDBssocA=; b=zn23Pea0O/EvXTT1oOczxuzaGhwS28nr9aGbIqB77p5DQCtb+okUIOxPhrzPF+rMe7 MrLk5Hj8jddyAO9ZzsLqnrPA4hamakLNCS+VZ9VYN8IsJ9jbxNj4RtxdjbW2a1HwJPnk G2KLAO37HAT/poew37HYbmqxUv/5nPnCjkuUgAut9Fs7VT0GEKhh5LnpoPvOOY7N8kqj JkAOCMc9jN0kHvB8MOjnuqSfunRYBRHsacW7IV4s25VRoi5tYruQtjvgOiMMbJ61CTGa hAy2u7v9hDBIZyJ/P+sDApLBdeIldeqnDd/vqn3QlOtm+OjzJ2Ofif0TSr1fvhz/H3rP cVmQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@foss.st.com header.s=selector1 header.b=R3zXFw4w; spf=pass (google.com: domain of linux-kernel+bounces-14613-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-14613-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=foss.st.com Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id 201-20020a6300d2000000b005cdf488ef16si18058009pga.188.2024.01.02.08.54.56 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jan 2024 08:54:56 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-14613-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@foss.st.com header.s=selector1 header.b=R3zXFw4w; spf=pass (google.com: domain of linux-kernel+bounces-14613-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-14613-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=foss.st.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 55A79283FA4 for <ouuuleilei@gmail.com>; Tue, 2 Jan 2024 16:47:17 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 350BF15488; Tue, 2 Jan 2024 16:47:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=foss.st.com header.i=@foss.st.com header.b="R3zXFw4w" X-Original-To: linux-kernel@vger.kernel.org Received: from mx07-00178001.pphosted.com (mx08-00178001.pphosted.com [91.207.212.93]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 047BF14F89 for <linux-kernel@vger.kernel.org>; Tue, 2 Jan 2024 16:47:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=foss.st.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=foss.st.com Received: from pps.filterd (m0046660.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 4029bOla028296; Tue, 2 Jan 2024 17:10:46 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foss.st.com; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; s= selector1; bh=kPETBoGH+akjcEbMQz/7+ofwHwOQ7qKVNhjHOwjNL2A=; b=R3 zXFw4wttd7VqVoeDFAMoxQy2IbpeaunrpFeptzgyTd3Mu2vHHmDtdXqrI9jRxKJY 0XCQq+kd1OLw6vQg1QGatoGBcg8XZ0Ik4KknQRL4trYns2yUgHFoh556UhtVaRNF GjL53p6pG9QTqmkZS3G5DO+aUh8bMnoLi7RJSOiMmA+7Om21t+99pl5sySuIizpY Ws1QOL0SVFWJQtR3ZwM0guR6riMxRhkOSbFjcHXHNhMrF/KkyQ1DguUQf8lmFftj qWrVNqsISHLa0b58Eoo/Ugx6z/PF1fqGk3jc3rBFr5dA5bqotv9iRitqYvnzjlck NmvV+NM+gxNwqZSRpMyA== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com (PPS) with ESMTPS id 3va978gmxv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 02 Jan 2024 17:10:46 +0100 (CET) Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id EA840100062; Tue, 2 Jan 2024 17:10:45 +0100 (CET) Received: from Webmail-eu.st.com (shfdag1node1.st.com [10.75.129.69]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id E1F852B5687; Tue, 2 Jan 2024 17:10:45 +0100 (CET) Received: from localhost (10.201.20.114) by SHFDAG1NODE1.st.com (10.75.129.69) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Tue, 2 Jan 2024 17:10:45 +0100 From: Antonio Borneo <antonio.borneo@foss.st.com> To: Andy Whitcroft <apw@canonical.com>, Joe Perches <joe@perches.com>, Dwaipayan Ray <dwaipayanray1@gmail.com>, Lukas Bulwahn <lukas.bulwahn@gmail.com> CC: Antonio Borneo <antonio.borneo@foss.st.com>, <linux-kernel@vger.kernel.org>, =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= <clement.leger@bootlin.com>, =?utf-8?q?Cl?= =?utf-8?q?=C3=A9ment_Le_Goffic?= <clement.legoffic@foss.st.com>, <linux-stm32@st-md-mailman.stormreply.com> Subject: [PATCH v2] checkpatch: use utf-8 match for spell checking Date: Tue, 2 Jan 2024 17:10:38 +0100 Message-ID: <20240102161038.22347-1-antonio.borneo@foss.st.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231212094310.3633-1-antonio.borneo@foss.st.com> References: <20231212094310.3633-1-antonio.borneo@foss.st.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-ClientProxiedBy: EQNCAS1NODE4.st.com (10.75.129.82) To SHFDAG1NODE1.st.com (10.75.129.69) X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.997,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-01-02_04,2024-01-02_01,2023-05-22_02 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785068740944652077 X-GMAIL-MSGID: 1786998420566552632 |
Series |
[v2] checkpatch: use utf-8 match for spell checking
|
|
Commit Message
Antonio Borneo
Jan. 2, 2024, 4:10 p.m. UTC
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.
Signed-off-by: Antonio Borneo <antonio.borneo@foss.st.com>
Reported-by: Clément Le Goffic <clement.legoffic@foss.st.com>
---
Changes in v2:
- use $rawline_utf8 also in the while-loop's body;
- fix path of checkpatch in the commit message.
---
scripts/checkpatch.pl | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
base-commit: b85ea95d086471afb4ad062012a4d73cd328fa86
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 25fdb7fda112..2d122d232c6d 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -3477,9 +3477,10 @@ sub process { # Check for various typo / spelling mistakes if (defined($misspellings) && ($in_commit_log || $line =~ /^(?:\+|Subject:)/i)) { - while ($rawline =~ /(?:^|[^\w\-'`])($misspellings)(?:[^\w\-'`]|$)/gi) { + my $rawline_utf8 = decode("utf8", $rawline); + while ($rawline_utf8 =~ /(?:^|[^\w\-'`])($misspellings)(?:[^\w\-'`]|$)/gi) { my $typo = $1; - my $blank = copy_spacing($rawline); + my $blank = copy_spacing($rawline_utf8); my $ptr = substr($blank, 0, $-[1]) . "^" x length($typo); my $hereptr = "$hereline$ptr\n"; my $typo_fix = $spelling_fix{lc($typo)};