diff options
| author | Joe Perches <joe@perches.com> | 2026-11-01 10:36:27 -0800 |
|---|---|---|
| committer | Andrew Morton <akpm@linux-foundation.org> | 2026-11-13 00:18:28 -0800 |
| commit | 7d735dd9bfef2b43d3e213828a8efd3b46aca92d (patch) | |
| tree | 0a15926aebd20bb80df68c9add93179fabad0ce7 /scripts | |
| parent | 86f93aff30b4c762fa1d6e830a25954bb33808aa (diff) | |
| download | linux-next-7d735dd9bfef2b43d3e213828a8efd3b46aca92d.tar.gz linux-next-7d735dd9bfef2b43d3e213828a8efd3b46aca92d.zip | |
get_maintainer.pl: fix inexact file pattern matching
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.
Link: https://lore.kernel.org/9d9626b16393901994012fa59824a63e96acd6ab.camel@perches.com
Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Cc: Borislav Petkov <bp@alien8.de>
Diffstat (limited to 'scripts')
| -rwxr-xr-x | scripts/get_maintainer.pl | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/scripts/get_maintainer.pl b/scripts/get_maintainer.pl index 16b80a700d4a..48328c48f534 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 =~ /\(\?:/) { |
