Received: by 2002:a05:6358:489b:b0:bb:da1:e618 with SMTP id x27csp6206567rwn; Tue, 13 Sep 2022 00:02:19 -0700 (PDT) X-Google-Smtp-Source: AA6agR6gKJXX9mNfIBTZr1hOIBieGDmK6nbwMgzI3hcEXi1LeaxMPvpi3u+Ch32yvn3kwep5gK74 X-Received: by 2002:a17:90b:4a8a:b0:202:8eec:b87a with SMTP id lp10-20020a17090b4a8a00b002028eecb87amr2511260pjb.48.1663052539612; Tue, 13 Sep 2022 00:02:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663052539; cv=none; d=google.com; s=arc-20160816; b=qZpDCgnT6/HAsJgz6A2vzwss1UTN5YKs+P2nneIgxe4N+KeptJeg2CMl5pARXJiJGF k+Fs9wVcoQ80sPAOWO3rM+PGmUr8RPw5aSbE2Cgz0Lk1SfF084c2WaS3hGFGgN3DMbp5 J3EreC/u8mzeXidv7dZRwjjmGECVEPMo1CUm3OALaGsj5RjapIEmMu/bY204tNZGzg9t JshJLKRADwKVA8c+sIKS1szGHg9iogeJ3t4RbET79QlD/jEQIpGwxULeh41yAijKrpkf VHDIMXoOgcy1YyhJIOHQd2fbiTnfRB75cB92qSlf1dLBdHDOntEn6eEOtw+kT+d7z878 0cCg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=6OFVncho9CWE/7b6Ak6mA3hXTMv6MBI1r90JjAcxY3U=; b=PRKmgNhjnECoJWwfqVa1fHaZJ3AUVVAGhY7bCut89oiR9M6DVbzVjyxsKkelPq275I J+yc1KNqXCPXveoZGJIscEjAj5XpzxCYhqtdJGRwSn5fK8FoUxwqH6G4w1sXLFqKjIFy gCmOCeptnaszfFAT4TI2BAkHJRswZv4ZM+Cw3YQEifjvL/3IpVcCj2hmnRF/1UQiSRL2 lNbVGHuHAcaA0ukh2TUyJgA9gJda5jH+Ym0a8TUGYZbyB7O/Isdd0G+M+YiKQCt0+Xof 7QrVDSgupd2thaXNbynfMYU8rTLWe/eIM4+dU9fIfrs+owO1Hk2gqhCycCghdz354998 YY5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=ZSMbJTrg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v20-20020a63f854000000b0042b80821b1csi10911528pgj.371.2022.09.13.00.02.06; Tue, 13 Sep 2022 00:02:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=ZSMbJTrg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230458AbiIMGlW (ORCPT + 99 others); Tue, 13 Sep 2022 02:41:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35278 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230374AbiIMGlU (ORCPT ); Tue, 13 Sep 2022 02:41:20 -0400 Received: from mail-oa1-x33.google.com (mail-oa1-x33.google.com [IPv6:2001:4860:4864:20::33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8CFC352FDE; Mon, 12 Sep 2022 23:41:18 -0700 (PDT) Received: by mail-oa1-x33.google.com with SMTP id 586e51a60fabf-12b542cb1d3so19820731fac.13; Mon, 12 Sep 2022 23:41:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date; bh=6OFVncho9CWE/7b6Ak6mA3hXTMv6MBI1r90JjAcxY3U=; b=ZSMbJTrgUXaM3OPACB7qDY21W74tCNW+uTxAPFlof/2gE86A2+jsfVv3HHdo0WwQeE Uv4dHRAdm8sxBcsu4rzvuUCYwR//L0CqK4AtNG6+12d+sr5oVQNQzAgHwsqoi483lXAe HnAS4FRKDlEfCd78fcWOx1w1L9F+RwBFdbREqcZwxtNsH2N1X2T21lpUPhjMbHV6LzXT DQxuCsoKuvly1MHS8DbEtKpNTI2IiAkKExgE4JQOt5hF6ZniAA+iECJJO8lT6AlnJJvG ra+SLUm0hxJSCSdgtaa6mLJBwkp0FCotfMDzMYG67sgFaNs4VaxvX6VsagDqbdBeXdFN Fv1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date; bh=6OFVncho9CWE/7b6Ak6mA3hXTMv6MBI1r90JjAcxY3U=; b=7BGy/4tcxLwW4Tm9rRotTUjLdhD/CokGSDugOycHehLkVw6vKKOJ+FDAsH0jgtfJSa Snv243xTHd2s9QbWazbZtkzDqf9iST1Cf/1pi4VehNPwIiSMNBF9cg3UIYGbDpxcl1Zb Gah3Ny6C/tJCymKVNhNdYtBFj4JpZmkx466wreRdeMhblHiAnYdiowIyx6PQxC8YWV/U oXNtaIWHgUock/A/sPFOmXmgThgByXg0ZSqMVol66F9Z8IOyHQ1z8ukD+2HTDwDaG5+M +jxrUdRbzZXaPAOVYPgJcOTokwg/C0fsJa3yD0IM5+opOMsiZ0IhAQKf5z3FfdbbRbM3 tQLw== X-Gm-Message-State: ACgBeo3rSamMsR8gXJu2alfX5pC54m+wcGqa3R+NgKKZ8RJ33sJubIkI rcLYxW4cWXkBNcT/ekYTP6pSir5FdCxqbzmK4UjAFuy+u/0= X-Received: by 2002:a05:6808:1412:b0:342:ff44:6e5d with SMTP id w18-20020a056808141200b00342ff446e5dmr937736oiv.160.1663051277691; Mon, 12 Sep 2022 23:41:17 -0700 (PDT) MIME-Version: 1.0 References: <20220910083835.2219239-1-niklas.soderlund@corigine.com> <7b2159922e989b1a5d5a3662fddb3c5ee2a97761.camel@toradex.com> In-Reply-To: <7b2159922e989b1a5d5a3662fddb3c5ee2a97761.camel@toradex.com> From: Dwaipayan Ray Date: Tue, 13 Sep 2022 12:11:06 +0530 Message-ID: Subject: Re: [PATCH v6] checkpatch: warn for non-standard fixes tag style To: Philippe Schenker Cc: "corbet@lwn.net" , "sfr@canb.auug.org.au" , "niklas.soderlund@corigine.com" , "linux-kernel@vger.kernel.org" , "linux-doc@vger.kernel.org" , "joe@perches.com" , "lukas.bulwahn@gmail.com" , "apw@canonical.com" , "louis.peens@corigine.com" , "simon.horman@corigine.com" , "oss-drivers@corigine.com" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham 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 On Sun, Sep 11, 2022 at 9:08 PM Philippe Schenker wrote: > > On Sat, 2022-09-10 at 10:38 +0200, Niklas S=C3=B6derlund wrote: > > Add a warning for fixes tags that does not fall in line with the > > standards specified by the community. > > > > Signed-off-by: Niklas S=C3=B6derlund > > Reviewed-by: Simon Horman > > Reviewed-by: Louis Peens > > Reviewed-by: Philippe Schenker > For the documentation part, Acked-by: Dwaipayan Ray Thanks. > > --- > > * Changes since v5 > > - Add support for --fix option for checkpatch.pl. > > > > * Changes since v4 > > - Extend test to cover lines with whitespace before the fixes: tag, > > e.g. > > match check on /^\s*fixes:?/i. > > > > * Changes since v3 > > - Add test that title in tag match title of commit referenced by sha1. > > > > * Changes since v2 > > - Change the pattern to match on 'fixes:?' to catch more malformed > > tags. > > > > * Changes since v1 > > - Update the documentation wording and add mention one cause of the > > message can be that email program splits the tag over multiple > > lines. > > --- > > Documentation/dev-tools/checkpatch.rst | 8 +++++ > > scripts/checkpatch.pl | 43 > > ++++++++++++++++++++++++++ > > 2 files changed, 51 insertions(+) > > > > diff --git a/Documentation/dev-tools/checkpatch.rst > > b/Documentation/dev-tools/checkpatch.rst > > index b52452bc2963..8c8456a3bd18 100644 > > --- a/Documentation/dev-tools/checkpatch.rst > > +++ b/Documentation/dev-tools/checkpatch.rst > > @@ -612,6 +612,14 @@ Commit message > > > > See: > > https://www.kernel.org/doc/html/latest/process/submitting-patches.html#= describe-your-changes > > > > + **BAD_FIXES_TAG** > > + The Fixes: tag is malformed or does not fall in line with the > > standards > > + specified by the community. This can occur if the tag have been > > split into > > + multiple lines (e.g., when pasted in email program with word > > wrapping > > + enabled). > > + > > + See: > > https://www.kernel.org/doc/html/latest/process/submitting-patches.html#= describe-your-changes > > + > > > > Comparison style > > ---------------- > > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl > > index 79e759aac543..77f577535fc3 100755 > > --- a/scripts/checkpatch.pl > > +++ b/scripts/checkpatch.pl > > @@ -3140,6 +3140,49 @@ sub process { > > } > > } > > > > +# Check Fixes: styles is correct > > + if (!$in_header_lines && $line =3D~ /^\s*fixes:?/i) { > > + my $orig_commit =3D ""; > > + my $id =3D "0123456789ab"; > > + my $title =3D "commit title"; > > + my $tag_case =3D 1; > > + my $tag_space =3D 1; > > + my $id_length =3D 1; > > + my $id_case =3D 1; > > + my $title_has_quotes =3D 0; > > + > > + if ($line =3D~ /(\s*fixes:?)\s+([0-9a- > > f]{5,})\s+($balanced_parens)/i) { > > + my $tag =3D $1; > > + $orig_commit =3D $2; > > + $title =3D $3; > > + > > + $tag_case =3D 0 if $tag eq "Fixes:"; > > + $tag_space =3D 0 if ($line =3D~ /^fixes= :? > > [0-9a-f]{5,} ($balanced_parens)/i); > > + > > + $id_length =3D 0 if ($orig_commit =3D~ > > /^[0-9a-f]{12}$/i); > > + $id_case =3D 0 if ($orig_commit !~ /[A- > > F]/); > > + > > + # Always strip leading/trailing parens > > then double quotes if existing > > + $title =3D substr($title, 1, -1); > > + if ($title =3D~ /^".*"$/) { > > + $title =3D substr($title, 1, - > > 1); > > + $title_has_quotes =3D 1; > > + } > > + } > > + > > + my ($cid, $ctitle) =3D > > git_commit_info($orig_commit, $id, > > + $title); > > + > > + if ($ctitle ne $title || $tag_case || > > $tag_space || > > + $id_length || $id_case || > > !$title_has_quotes) { > > + if (WARN("BAD_FIXES_TAG", > > + "Please use correct Fixes: style > > 'Fixes: <12 chars of sha1> (\"\")' - ie: 'Fixes: $cid > > (\"$ctitle\")'\n" . $herecurr) && > > + $fix) { > > + $fixed[$fixlinenr] =3D "Fixes: > > $cid (\"$ctitle\")"; > > + } > > + } > > + } > > + > > # Check email subject for common tools that don't need to be > > mentioned > > if ($in_header_lines && > > $line =3D~ > > /^Subject:.*\b(?:checkpatch|sparse|smatch)\b[^:]/i) { >