From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) (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 582CE430B9C for ; Mon, 2 Mar 2026 03:45:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=216.40.44.12 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772423125; cv=none; b=PImLxZpprGkZ9qqfgqm5fnWTFoyaR7HHcKsZzhnAuiC0HjNG6UCA3QAnLyqL52T5s1Wk9F5AXGBZzbN4OaOfOHnfRVe2rXB5oMmfNe6DDo4CEjkO4Gxc7lVWnokDmikwcEgoC/ZB/biBJlFO5bgoTSBC5Z+5FcjsrP48e5GenI4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772423125; c=relaxed/simple; bh=VjezQ9xwSDRn+PkLRIjmN1lHYPuteh283FoL07ge8b8=; h=Message-ID:Subject:From:To:Cc:Date:In-Reply-To:References: Content-Type:MIME-Version; b=AjE+UVO1M578uOm7lLNxqyVrmtpmasjHcDKmRrdqTsl7eURFWGa8eEFZR5D+w/b1R+Nm7nY0YT7nv7rLtJjblXGn0EChGvE43n9oXt2gwq/JuENMfWZqGs3bb68PzrAShqXH8RfbeWz0ZSNOITTo0LgL9jClBzyuvBxllHPRV9Y= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=perches.com; spf=pass smtp.mailfrom=perches.com; arc=none smtp.client-ip=216.40.44.12 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=perches.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=perches.com Received: from omf15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 5FFD85B92D; Mon, 2 Mar 2026 03:45:17 +0000 (UTC) Received: from [HIDDEN] (Authenticated sender: joe@perches.com) by omf15.hostedemail.com (Postfix) with ESMTPA id BC7D11F; Mon, 2 Mar 2026 03:45:15 +0000 (UTC) Message-ID: <14d23d10a39137e4a6e11909fca477dc0e64dd83.camel@perches.com> Subject: Re: [PATCH] get_maintainer: add ** globstar pattern support From: Joe Perches To: Matteo Croce , Andrew Morton Cc: linux-kernel@vger.kernel.org Date: Sun, 01 Mar 2026 19:45:14 -0800 In-Reply-To: <20260302025337.74629-1-teknoraver@meta.com> References: <20260302025337.74629-1-teknoraver@meta.com> Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.58.3 (3.58.3-1.fc43) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Rspamd-Server: rspamout05 X-Rspamd-Queue-Id: BC7D11F X-Stat-Signature: kdcc4macz4ymtnc7ytrkzuytrsn76wnk X-Session-Marker: 6A6F6540706572636865732E636F6D X-Session-ID: U2FsdGVkX1+i3rpMZJbIk9O+ERHsVvwVbCdgmCZi+yM= X-HE-Tag: 1772423115-848001 X-HE-Meta: U2FsdGVkX1+VYOa/gDsFSTZUtIAt5tbdc2jCIi1D+zy3NO5y0b+ck8jnP0tUAFwldp36VDYCLA/7ziTvU01Jt6lcde/Vdd0ctIF1+jEIcPHG9jUiuiZY4yizvOzkeOcnNCcvQjOF411c9ApaPw5Z6UuFnDTR61AI+nLYQ1gxJ4/cTWywENtw99e97+QUaMaLVj5JRD4EPD6o/mc9ulox9CHHbrsqYMtcue3x1OTgmY04lsKU4QcmBLTsrbHi+4Jq77DoQOiFHDCyVfl/Bb7w6cP1VS40w3uxqjcPUAC8bMqTHC3D5BW5UowVBWhnjJ4jJolE0OOLB9zx95QRaN5Zi3e8DoysWX1lv3mx4I4Mdhrbm59xJUkXQTEo3S+KrSL7jigQkYjP59mu6rRRyv8CsF32KRjqOi+Afy3b/dQ3t0en5Qcg5lkmH+Ugvoo12Ac5 On Mon, 2026-03-02 at 03:53 +0100, Matteo Croce wrote: > Add support for the ** globstar operator in MAINTAINERS F: and X: pattern= s, > matching any number of path components (like Python's ** glob). >=20 > The existing * to .* conversion with slash-count check is preserved. > ** is converted to (?:.*), a non-capturing group used as a marker to > bypass the slash-count check in file_match_pattern(), allowing the > pattern to cross directory boundaries. >=20 > Tested by running `scripts/get_maintainer.pl --self-test=3Dpatterns` > with the following line added to MAINTAINERS: >=20 > F: **/*[_-]kunit*.c >=20 > Signed-off-by: Matteo Croce <[teknoraver@meta.com](mailto:teknoraver@meta= .com)> Simpler, thanks. Acked-by: Joe Perches > --- > scripts/get_maintainer.pl | 9 +++++++-- > 1 file changed, 7 insertions(+), 2 deletions(-) >=20 > diff --git a/scripts/get_maintainer.pl b/scripts/get_maintainer.pl > index 4414194bedcf..f0ca0db6ddc2 100755 > --- a/scripts/get_maintainer.pl > +++ b/scripts/get_maintainer.pl > @@ -375,8 +375,10 @@ sub read_maintainer_file { > ##Filename pattern matching > if ($type eq "F" || $type eq "X") { > $value =3D~ s@\.@\\\.@g; ##Convert . to \. > + $value =3D~ s/\*\*/\x00/g; ##Convert ** to placeholder > $value =3D~ s/\*/\.\*/g; ##Convert * to .* > $value =3D~ s/\?/\./g; ##Convert ? to . > + $value =3D~ s/\x00/(?:.*)/g; ##Convert placeholder to (?:.*) > ##if pattern is a directory and it lacks a trailing slash, add one > if ((-d $value)) { > $value =3D~ s@([^/])$@$1/@; > @@ -746,8 +748,10 @@ sub self_test { > if (($type eq "F" || $type eq "X") && > ($self_test eq "" || $self_test =3D~ /\bpatterns\b/)) { > $value =3D~ s@\.@\\\.@g; ##Convert . to \. > + $value =3D~ s/\*\*/\x00/g; ##Convert ** to placeholder > $value =3D~ s/\*/\.\*/g; ##Convert * to .* > $value =3D~ s/\?/\./g; ##Convert ? to . > + $value =3D~ s/\x00/(?:.*)/g; ##Convert placeholder to (?:.*) > ##if pattern is a directory and it lacks a trailing slash, add one > if ((-d $value)) { > $value =3D~ s@([^/])$@$1/@; > @@ -921,7 +925,7 @@ sub get_maintainers { > my $value_pd =3D ($value =3D~ tr@/@@); > my $file_pd =3D ($file =3D~ tr@/@@); > $value_pd++ if (substr($value,-1,1) ne "/"); > - $value_pd =3D -1 if ($value =3D~ /^\.\*/); > + $value_pd =3D -1 if ($value =3D~ /^(\.\*|\(\?:\.\*\))/); > if ($value_pd >=3D $file_pd && > range_is_maintained($start, $end) && > range_has_maintainer($start, $end)) { > @@ -955,6 +959,7 @@ sub get_maintainers { > $line =3D~ s/([^\\])\.([^\*])/$1\?$2/g; > $line =3D~ s/([^\\])\.$/$1\?/g; ##Convert . back to ? > $line =3D~ s/\\\./\./g; ##Convert \. to . > + $line =3D~ s/\(\?:\.\*\)/\*\*/g; ##Convert (?:.*) to ** > $line =3D~ s/\.\*/\*/g; ##Convert .* to * > } > my $count =3D $line =3D~ s/^([A-Z]):/$1:\t/g; > @@ -1048,7 +1053,7 @@ sub file_match_pattern { > if ($file =3D~ m@^$pattern@) { > my $s1 =3D ($file =3D~ tr@/@@); > my $s2 =3D ($pattern =3D~ tr@/@@); > - if ($s1 =3D=3D $s2) { > + if ($s1 =3D=3D $s2 || $pattern =3D~ /\(\?:/) { > return 1; > } > } >=20 > ```