Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp3474860pxp; Tue, 8 Mar 2022 15:24:32 -0800 (PST) X-Google-Smtp-Source: ABdhPJyVH9AterVv03n7+nRq75TafFNgdQwF+nawTDwXxNOa3qaWmytbW1ESddTBq9nK+x/K3/pY X-Received: by 2002:a17:902:bf07:b0:14f:a3a7:97a0 with SMTP id bi7-20020a170902bf0700b0014fa3a797a0mr19937623plb.105.1646781872684; Tue, 08 Mar 2022 15:24:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646781872; cv=none; d=google.com; s=arc-20160816; b=XCjLaq+ACCe9UI1z9IypGUB9YYILt8ASF2zN7aSVzlhTYqftk97IlwR9cd+UY9RbT5 J/6kVCmSCo5zJgZa2zRcAf74c0ge91p1Nr2ZnRZvHwNvMe8nflvYbwdXo1UhOLjxoggM AcEp9sz6ibm6JfdwpCCJSAG0wYK+lrfiZ+ryRXYjt0R2f/8gZe4Me7vD91Je9ltmTk6Y lL7akQtEuANoM5kbH3/96m0idoq8YbckGuG8F3lIc+SqXiAq0jWOfWplwd1IzLm64cDS O1gpaxg47JLuvLuEMd5YyGhnJCqm2CnCau0G3n/xPw0IzAVFnIe9olmljKj9qDGBnFfM U3Nw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=Katfixvv58g4YqeJPjxj65bxdLKnLJ20HsyYR2QQDyQ=; b=b9iinD2zDZ+1qvWvpfMXoA4FJ7H42NXLEqjNI5azGPpeBQa1m+NW3agNojmFN+fEY0 aMitBC+4/AchVX4mTh1PUYpBFyNL9Us9w/+uBdBMYW+/wX9Lfwca0EHDzxh598eswQHt oVv3DLahw3I4E/NjILiX9CRaJWSqaCiwpqfdFzj94tblD/ef7xWkQLT0f9yLrWPKQh/A rZYFM2qWc4x2vnElFnBF8O2P0LVXxk3N4d7oeZqVikrfk5xb/0LZDxJlO7MCLzxQIsFH O9U8j1Sph6rx18wmO1XjwkDdycIVYHs1k2tBvAAMmWT93ykqhwRzIQh0hdxEcBwW13ra XgmQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=ihvFJayx; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id m10-20020a1709026bca00b0014a9b93e68dsi241187plt.623.2022.03.08.15.24.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Mar 2022 15:24:32 -0800 (PST) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=ihvFJayx; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 060948F631; Tue, 8 Mar 2022 15:15:52 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344690AbiCHH7m (ORCPT + 99 others); Tue, 8 Mar 2022 02:59:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47508 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233572AbiCHH7l (ORCPT ); Tue, 8 Mar 2022 02:59:41 -0500 Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8BA70205C7 for ; Mon, 7 Mar 2022 23:58:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1646726325; x=1678262325; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=VQNvcDVcyglSi/SgZclVCjS5AQucsWOUcgatQiv+Xng=; b=ihvFJayxvoEAoRc8xp3ipG5oAlbyjlnwy8Lebd5N3O4NnlWpTugdbhx7 xYCREn0pEM/IuBaCc1ygjER29hRVNrtvTLVEPOyzQop/lEWODw5s+C7nh C5t2Nt7+Y7LNXFmQn2xlx95+IdsomNZeC45MJ8gUA0/tFxtwdGuIXjJoQ 29OzLoqppiYDj6KD2HbGS5nfPCb3DVHUl+BE2teNFreHFO4cjkoYnMbC3 SpdUQmdmrE6YupI4xv2tfgS0mp2FSIZ1xUflx5f05Aek5sBGELQ/Y3n3E WRjWezX+1AgRpcxkvQpNYkNDYPiwdya7vnfvbwQyxZbSZY7g1AcjqkP5S w==; X-IronPort-AV: E=McAfee;i="6200,9189,10279"; a="242058280" X-IronPort-AV: E=Sophos;i="5.90,163,1643702400"; d="scan'208";a="242058280" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Mar 2022 23:58:45 -0800 X-IronPort-AV: E=Sophos;i="5.90,163,1643702400"; d="scan'208";a="687839821" Received: from ejoldes-mobl1.ger.corp.intel.com (HELO [10.252.54.36]) ([10.252.54.36]) by fmsmga001-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Mar 2022 23:58:40 -0800 Message-ID: Date: Tue, 8 Mar 2022 09:58:45 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.6.1 Subject: Re: [PATCH] checkpatch: use python3 to find codespell dictionary Content-Language: en-US To: Sagar Patel , Andy Whitcroft Cc: Joe Perches , linux-kernel@vger.kernel.org References: <20220308025547.20412-1-sagarmp@cs.unc.edu> From: =?UTF-8?Q?P=c3=a9ter_Ujfalusi?= In-Reply-To: <20220308025547.20412-1-sagarmp@cs.unc.edu> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,RDNS_NONE,SPF_HELO_NONE, T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Sagar, On 08/03/2022 04:55, Sagar Patel wrote: > Commit 0ee3e7b8893e ("checkpatch: get default codespell dictionary path > from package location") introduced the ability to search for the > codespell dictionary rather than hardcoding its path. > > codespell requires Python 3.6 or above, but on some systems, the python > binary is a Python 2.7 interpreter. In this case, searching for the > dictionary fails, subsequently making codespell fail: > > No codespell typos will be found - file '/usr/share/codespell/dictionary.txt': No such file or directory > > So, use python3 to remove ambiguity. > > In addition, when searching for the dictionary, do not check if the > codespell binary exists since codespell can be installed via a Python > package manager. In this case, a codespell binary is not exported in > $PATH, but a dictionary does exist. Installing codespell via pip will place the 'codespell' executable under the user's $HOME/.local/bin/ and it expects that it is in PATH: # pip install codespell Defaulting to user installation because normal site-packages is not writeable Collecting codespell Downloading codespell-2.1.0-py3-none-any.whl (177 kB) |████████████████████████████████| 177 kB 1.9 MB/s Installing collected packages: codespell WARNING: The script codespell is installed in '/home/my_user/.local/bin' which is not on PATH. Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location. Having said that, the executable itself is not used by checkpatch.pl, so Reviewed-by: Peter Ujfalusi > > Signed-off-by: Sagar Patel > --- > scripts/checkpatch.pl | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl > index b01c36a15d9d..46302e074b18 100755 > --- a/scripts/checkpatch.pl > +++ b/scripts/checkpatch.pl > @@ -334,7 +334,7 @@ if ($user_codespellfile) { > } elsif (!(-f $codespellfile)) { > # If /usr/share/codespell/dictionary.txt is not present, try to find it > # under codespell's install directory: /data/dictionary.txt > - if (($codespell || $help) && which("codespell") ne "" && which("python") ne "") { > + if (($codespell || $help) && which("python3") ne "") { > my $python_codespell_dict = << "EOF"; > > import os.path as op > @@ -344,7 +344,7 @@ codespell_file = op.join(codespell_dir, 'data', 'dictionary.txt') > print(codespell_file, end='') > EOF > > - my $codespell_dict = `python -c "$python_codespell_dict" 2> /dev/null`; > + my $codespell_dict = `python3 -c "$python_codespell_dict" 2> /dev/null`; > $codespellfile = $codespell_dict if (-f $codespell_dict); > } > } -- Péter