From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) (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 CC27D426D02 for ; Mon, 2 Mar 2026 16:48:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=216.40.44.15 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772470099; cv=none; b=MU6hZML96o6sV3HOpnnLNx/9oBagzzgjAuAWVrPrCZT+5ABALiEOinFz/uwVK8XMoKdLEC4VftJKCS1h0Ts635ny8GFQQXdknQLMls0ROFAvZJrPWknUoRpkXSjSoFUTHE2syXOFajlRAxXv14b+e1uav5jCWRUcKgBTtcHkkhU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772470099; c=relaxed/simple; bh=Bf2fanSClqZUTbpMjgVsTtD0GPjTa6uPWrhnR+nnUVU=; h=Message-ID:Subject:From:To:Cc:Date:In-Reply-To:References: Content-Type:MIME-Version; b=JqvA4PSn2mshGF1sQGMuO4TCxCQD77h9DMOY54adWTS36o50ydR7oSMbXuLn9/ZN+1t2r95AAe3ZZnuIJiw6E3II2mZ0nYWdhqGshLk+24mSj0cGuL1qpGnv3h/79bg/6xgjGe0aP0i5d3bwWx7XB0EhIXJr7A1MlH4qVy3Kpug= 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.15 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 omf17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 941BFC119C; Mon, 2 Mar 2026 16:48:15 +0000 (UTC) Received: from [HIDDEN] (Authenticated sender: joe@perches.com) by omf17.hostedemail.com (Postfix) with ESMTPA id 9A7A919; Mon, 2 Mar 2026 16:48:13 +0000 (UTC) Message-ID: Subject: Re: [PATCH v2] get_maintainer: add ** glob pattern support From: Joe Perches To: Matteo Croce , Andrew Morton Cc: linux-kernel@vger.kernel.org Date: Mon, 02 Mar 2026 08:48:12 -0800 In-Reply-To: <20260302103822.77343-1-teknoraver@meta.com> References: <20260302103822.77343-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-Stat-Signature: c5o93dsntqbprcnw11k6zayjbtm8max1 X-Rspamd-Server: rspamout08 X-Rspamd-Queue-Id: 9A7A919 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Session-ID: U2FsdGVkX1+fCZyBc+VXTAs/hqCzBXbWFTVFM7M2bA8= X-HE-Tag: 1772470093-923633 X-HE-Meta: U2FsdGVkX18WIDAaSJQvV8uce2KOrJPWdxOIVi27bnDvlBtXDx/w7cfWO+z/jnD1lTEkl3s7r6Ppk7jlyWJ3ng22OLGlysbFDZwRz6SroNKZ0hgvWBbPm4E5XaPK3TB4JHFRLbmpVj1INWWNBs5QVjetQPOzUdOTbvfhC7R1lxOf3A7fQ8/XUeBMv9UczsdqBj0xYTIb8hHp0tF4PdU8Uf6FT456iR8OzAEc7nj6IQ7OnBnL3KBzr4UaIlM+lbIuLrTEMgSLxKh7Ame9lGhq8ey1FkxaxeR/5NYya8G6/kgDQQWFl4G8JmhBenHWKMkBAN2Q8yLD5F//2Vzc4a75alfroNXJgbLsMnLmVdY1FSeBl/7DMhXYsed9Yt62oGY0kBqJIU/CLGzdAs2YFIS9wzF1nTiG1Y0msxAPoupdAb5yELqwnY0kIAjnDESQWm9K On Mon, 2026-03-02 at 11:38 +0100, Matteo Croce wrote: > Add support for the ** glob operator in MAINTAINERS F: and X: patterns, > 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 > This enables patterns like F: **/*[_-]kunit*.c to match files at any > depth in the tree. >=20 > Signed-off-by: Matteo Croce Acked-by: Joe Perches > --- > MAINTAINERS | 1 + > scripts/get_maintainer.pl | 9 +++++++-- > 2 files changed, 8 insertions(+), 2 deletions(-) >=20 > diff --git a/MAINTAINERS b/MAINTAINERS > index 96e97d25e1c2..4ca6f6745f9c 100644 > --- a/MAINTAINERS > +++ b/MAINTAINERS > @@ -35,6 +35,7 @@ Descriptions of section entries and preferred order > F: drivers/net/ all files in and below drivers/net > F: drivers/net/* all files in drivers/net, but not below > F: */net/* all files in "any top level directory"/net > + F: fs/**/*foo*.c all *foo*.c files in any subdirectory of fs > One pattern per line. Multiple F: lines acceptable. > X: *Excluded* files and directories that are NOT maintained, same > rules as F:. Files exclusions are tested before file matches. > 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 > ```