From: Joe Perches <joe@perches.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: LKML <linux-kernel@vger.kernel.org>, Borislav Petkov <bp@alien8.de>
Subject: [PATCH] get_maintainer.pl: Fix inexact file pattern matching
Date: Sun, 01 Nov 2026 10:36:27 -0800 [thread overview]
Message-ID: <9d9626b16393901994012fa59824a63e96acd6ab.camel@perches.com> (raw)
The intent of file pattern matches is to exactly specify a
file pattern with or without wildcard **, *, or ? expansion.
The pattern match code failed to include a trailing $ to
match the end of the pattern.
A pattern like:
F: include/drm/drm
would match files like include/drm/drm_<foo>
Fix it and the self-test code too.
Signed-off-by: Joe Perches <joe@perches.com>
---
scripts/get_maintainer.pl | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/scripts/get_maintainer.pl b/scripts/get_maintainer.pl
index 16b80a700d4ac..48328c48f5341 100755
--- a/scripts/get_maintainer.pl
+++ b/scripts/get_maintainer.pl
@@ -768,6 +768,10 @@ sub self_test {
if ((-d $value)) {
$value =~ s@([^/])$@$1/@;
}
+ if (substr($value, -1) ne "/") {
+ $value .= '$';
+ }
+
if (!grep(m@^$value@, @lsfiles)) {
print("$x->{file}:$x->{linenr}: warning: no file matches\t$x->{line}\n");
}
@@ -1062,7 +1066,7 @@ sub file_match_pattern {
return 1;
}
} else {
- if ($file =~ m@^$pattern@) {
+ if ($file =~ m@^$pattern$@) {
my $s1 = ($file =~ tr@/@@);
my $s2 = ($pattern =~ tr@/@@);
if ($s1 == $s2 || $pattern =~ /\(\?:/) {
reply other threads:[~2026-11-01 18:36 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=9d9626b16393901994012fa59824a63e96acd6ab.camel@perches.com \
--to=joe@perches.com \
--cc=akpm@linux-foundation.org \
--cc=bp@alien8.de \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®