From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D0F85CE7AF9 for ; Thu, 28 Sep 2023 05:04:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230212AbjI1FEO (ORCPT ); Thu, 28 Sep 2023 01:04:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50012 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229445AbjI1FEN (ORCPT ); Thu, 28 Sep 2023 01:04:13 -0400 Received: from mail-ej1-x62d.google.com (mail-ej1-x62d.google.com [IPv6:2a00:1450:4864:20::62d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C4A1F8F for ; Wed, 27 Sep 2023 22:04:10 -0700 (PDT) Received: by mail-ej1-x62d.google.com with SMTP id a640c23a62f3a-99bf3f59905so1571436166b.3 for ; Wed, 27 Sep 2023 22:04:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1695877449; x=1696482249; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=IMt3VDFkV8v21xpyS36v/wPorubRh0WtZEJ/4wI1WC4=; b=WD7FtNpGWztgyXdP/zVeiTvntgHqIHr7hdfIcSfrtkcisvtjUWn+yNMc5B+XL/t/W2 Z2jCIcgfz2R8DApmtNpmoFsQpSAwJ0Oda1FWPhXg7SIKu5xnSRkH4gBbDR+RIH1x+vnh dXZ5gqeNxbOn+JOyJ/eoiCoY3W5GGMH61qT5NwNmvZE5CSeP5fwY0kaSaW5EedL9F1we 01z6bsfehFLrxee7aA6ckQqc2bFzMElTgcie7TnuYDtilnmrF5U6AkQ/DFBku7M49b0y UuGfXRmjUgZRupI2UO9WFK2xpHe6sI51KAgdgkUUdUORtqqVbQ4rVLahuk8vg8hrPxdd T96w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695877449; x=1696482249; 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:message-id:reply-to; bh=IMt3VDFkV8v21xpyS36v/wPorubRh0WtZEJ/4wI1WC4=; b=GNijKTNmDkB//crvGuAZTMoc9zsXpTRi9OkmMmGJbyAHe/xhIlzZfJ4i6Zl+Xaw3Q4 8qG7qg4Y4PGs/rXfIZNMJpL8iWUv04dsUOwoz8EIEdoBZHcA2MMd/wihOg5UADDJ9UIA z9fGIsbDxrtVdP2H9HhD3Iufgav4Wdlu4LO12O/DQnf25VyTSm88lgvqG4O52CvHZQNz 2WrAIydtbb9WuhZMuvGKwJes4xCdcyHwoqEPATAEb4qwQf0gQL7Ykm9dq6sVHqea5/yH 9+OVPi5A5GcHNhbd5IzqjV2e7lyu2QX+WHlL+2vFoW6fzAgnAmkWuE2JIhjBC38JcJqZ 5ERw== X-Gm-Message-State: AOJu0YzHgIx/bNQJogoO6RaPSn7y5xVcnW3JSVukATlg1ZynTQb4hc81 GJS90oEGJ3ajsUw/afiFSjBfvn3kLdabxo9U9ScHdA== X-Google-Smtp-Source: AGHT+IHsbDNwZygpDuT8nX6B5NMlbaklBzWjXfydWD5M8zeH1vBPpsNN38cIuIC0s484UMYxn+RCte3D4iaMMnjmMbY= X-Received: by 2002:a17:907:1dcc:b0:9ae:406c:3425 with SMTP id og12-20020a1709071dcc00b009ae406c3425mr221236ejc.0.1695877449159; Wed, 27 Sep 2023 22:04:09 -0700 (PDT) MIME-Version: 1.0 References: <20230928-get_maintainer_add_d-v2-0-8acb3f394571@google.com> <20230928-get_maintainer_add_d-v2-1-8acb3f394571@google.com> In-Reply-To: From: Justin Stitt Date: Thu, 28 Sep 2023 14:03:57 +0900 Message-ID: Subject: Re: [PATCH v2 1/2] get_maintainer: add patch-only keyword-matching To: Joe Perches Cc: linux-kernel@vger.kernel.org, Kees Cook , Nick Desaulniers , Nathan Chancellor , Jakub Kicinski , Krzysztof Kozlowski , geert@linux-m68k.org, gregkh@linuxfoundation.org, workflows@vger.kernel.org, mario.limonciello@amd.com, Konstantin Ryabitsev Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: workflows@vger.kernel.org On Thu, Sep 28, 2023 at 1:46=E2=80=AFPM Joe Perches wrote= : > > On Thu, 2023-09-28 at 04:23 +0000, Justin Stitt wrote: > > Add the "D:" type which behaves the same as "K:" but will only match > > content present in a patch file. > > > > To illustrate: > > > > Imagine this entry in MAINTAINERS: > > > > NEW REPUBLIC > > M: Han Solo > > W: https://www.jointheresistance.org > > D: \bstrncpy\b > > > > Our maintainer, Han, will only be added to the recipients if a patch > > file is passed to get_maintainer (like what b4 does): > > $ ./scripts/get_maintainer.pl 0004-some-change.patch > > > > If the above patch has a `strncpy` present in the subject, commit log o= r > > diff then Han will be to/cc'd. > > > > However, in the event of a file from the tree given like: > > $ ./scripts/get_maintainer.pl ./lib/string.c > > > > Han will not be noisily to/cc'd (like a K: type would in this > > circumstance) > > > > Signed-off-by: Justin Stitt > > --- > > MAINTAINERS | 5 +++++ > > scripts/get_maintainer.pl | 12 ++++++++++-- > > 2 files changed, 15 insertions(+), 2 deletions(-) > > > > diff --git a/MAINTAINERS b/MAINTAINERS > > index b19995690904..94e431daa7c2 100644 > > --- a/MAINTAINERS > > +++ b/MAINTAINERS > > @@ -59,6 +59,11 @@ Descriptions of section entries and preferred order > > matches patches or files that contain one or more of the wo= rds > > printk, pr_info or pr_err > > One regex pattern per line. Multiple K: lines acceptable. > > + D: *Diff content regex* (perl extended) pattern match that applies o= nly to > > + patches and not entire files (e.g. when using the get_maintainers= .pl > > + script). > > + Usage same as K:. > > + > > > > Maintainers List > > ---------------- > > diff --git a/scripts/get_maintainer.pl b/scripts/get_maintainer.pl > > index ab123b498fd9..a3e697926ddd 100755 > > --- a/scripts/get_maintainer.pl > > +++ b/scripts/get_maintainer.pl > > @@ -342,6 +342,7 @@ if ($tree && !top_of_kernel_tree($lk_path)) { > > > > my @typevalue =3D (); > > my %keyword_hash; > > +my %patch_keyword_hash; > > my @mfiles =3D (); > > my @self_test_info =3D (); > > > > @@ -369,8 +370,10 @@ sub read_maintainer_file { > > $value =3D~ s@([^/])$@$1/@; > > } > > } elsif ($type eq "K") { > > - $keyword_hash{@typevalue} =3D $value; > > - } > > + $keyword_hash{@typevalue} =3D $value; > > + } elsif ($type eq "D") { > > + $patch_keyword_hash{@typevalue} =3D $value; > > + } > > push(@typevalue, "$type:$value"); > > } elsif (!(/^\s*$/ || /^\s*\#/)) { > > push(@typevalue, $line); > > @@ -607,6 +610,11 @@ foreach my $file (@ARGV) { > > push(@keyword_tvi, $line); > > } > > } > > + foreach my $line(keys %patch_keyword_hash) { > > + if ($patch_line =3D~ m/${patch_prefix}$patch_keyword_hash{$line}= /x) { > > + push(@keyword_tvi, $line); > > + } > > + } > > } > > } > > close($patch); > > > > > My opinion: Nack. > > I think something like this would be better > as it avoids duplication of K and D content. If I understand correctly, this puts the onus on the get_maintainer users to select the right argument whereas adding "D:", albeit with some duplicate code, allows maintainers themselves to decide in exactly which context they receive mail. Adding a command line flag means sometimes K: is treated one way and sometimes treated a different way depending on the specific incantation. This could all be a moot point, though, as I believe Konstantin is trying to separate out the whole idea of a patch-sender needing to specify the recipients of a patch. Instead some middleware would capture mail and delegate automatically based on some queries set up by maintainers. Exciting idea, I wonder what the progress is on that? Cc: Konstantin Ryabitsev [1]: https://lore.kernel.org/all/20230726-june-mocha-ad6809@meerkat/ > --- > scripts/get_maintainer.pl | 16 +++++++++------- > 1 file changed, 9 insertions(+), 7 deletions(-) > > diff --git a/scripts/get_maintainer.pl b/scripts/get_maintainer.pl > index ab123b498fd9..07e7d744cadb 100755 > --- a/scripts/get_maintainer.pl > +++ b/scripts/get_maintainer.pl > @@ -57,6 +57,7 @@ my $subsystem =3D 0; > my $status =3D 0; > my $letters =3D ""; > my $keywords =3D 1; > +my $keywords_in_file =3D 0; > my $sections =3D 0; > my $email_file_emails =3D 0; > my $from_filename =3D 0; > @@ -272,6 +273,7 @@ if (!GetOptions( > 'letters=3Ds' =3D> \$letters, > 'pattern-depth=3Di' =3D> \$pattern_depth, > 'k|keywords!' =3D> \$keywords, > + 'kf|keywords-in-file!' =3D> \$keywords_in_file, > 'sections!' =3D> \$sections, > 'fe|file-emails!' =3D> \$email_file_emails, > 'f|file' =3D> \$from_filename, > @@ -318,6 +320,7 @@ if ($sections || $letters ne "") { > $subsystem =3D 0; > $web =3D 0; > $keywords =3D 0; > + $keywords_in_file =3D 0; > $interactive =3D 0; > } else { > my $selections =3D $email + $scm + $status + $subsystem + $web; > @@ -548,16 +551,14 @@ foreach my $file (@ARGV) { > $file =3D~ s/^\Q${cur_path}\E//; #strip any absolute path > $file =3D~ s/^\Q${lk_path}\E//; #or the path to the lk tree > push(@files, $file); > - if ($file ne "MAINTAINERS" && -f $file && $keywords) { > + if ($file ne "MAINTAINERS" && -f $file && $keywords && $keywords_= in_file) { > open(my $f, '<', $file) > or die "$P: Can't open $file: $!\n"; > my $text =3D do { local($/) ; <$f> }; > close($f); > - if ($keywords) { > - foreach my $line (keys %keyword_hash) { > - if ($text =3D~ m/$keyword_hash{$line}/x) { > - push(@keyword_tvi, $line); > - } > + foreach my $line (keys %keyword_hash) { > + if ($text =3D~ m/$keyword_hash{$line}/x) { > + push(@keyword_tvi, $line); > } > } > } > @@ -1076,6 +1077,7 @@ Output type options: > Other options: > --pattern-depth =3D> Number of pattern directory traversals (default: = 0 (all)) > --keywords =3D> scan patch for keywords (default: $keywords) > + --keywords-in-file =3D> scan file for keywords (default: $keywords_in_= file) > --sections =3D> print all of the subsystem sections with pattern match= es > --letters =3D> print all matching 'letter' types from all matching sec= tions > --mailmap =3D> use .mailmap file (default: $email_use_mailmap) > @@ -1086,7 +1088,7 @@ Other options: > > Default options: > [--email --tree --nogit --git-fallback --m --r --n --l --multiline > - --pattern-depth=3D0 --remove-duplicates --rolestats] > + --pattern-depth=3D0 --remove-duplicates --rolestats --keywords] > > Notes: > Using "-f directory" may give unexpected results: >