From: Tom Rini <trini@konsulko.com>
To: u-boot@lists.u-boot-project.org
Cc: Michal Simek <michal.simek@amd.com>
Subject: [PATCH v2 1/7] scripts: Check F: entries in all MAINTAINERS files
Date: Fri, 28 Aug 2026 19:50:19 -0600 [thread overview]
Message-ID: <20260829015026.473134-2-trini@konsulko.com> (raw)
In-Reply-To: <20260829015026.473134-1-trini@konsulko.com>
From: Michal Simek <michal.simek@amd.com>
Extend the checker to walk every MAINTAINERS file in the tree instead of
only the top-level one, so stale F: references in the per-board and
per-driver MAINTAINERS files are caught too.
Use git ls-files to enumerate the MAINTAINERS files so that only tracked
files are checked, ignored build artifacts are skipped and paths are
reported relative to the repository root. Fall back to find when running
outside a git checkout.
MAINTAINERS files under tools/buildman/ are skipped as they are test
fixtures whose F: paths are relative to the test setup rather than the
repository root.
Signed-off-by: Michal Simek <michal.simek@amd.com>
---
scripts/check_maintainers_files.sh | 80 ++++++++++++++++++++----------
1 file changed, 53 insertions(+), 27 deletions(-)
diff --git a/scripts/check_maintainers_files.sh b/scripts/check_maintainers_files.sh
index 4c1279958e98..ccac97a2d93e 100755
--- a/scripts/check_maintainers_files.sh
+++ b/scripts/check_maintainers_files.sh
@@ -1,44 +1,70 @@
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0
#
-# Check that every "F:" file reference in MAINTAINERS exists.
+# Check that every "F:" file reference in the MAINTAINERS files exists.
#
-# Each F: entry is treated as a shell glob (relative to the repo root),
-# matching the way MAINTAINERS wildcards work. If a pattern matches no
-# existing file or directory, it is reported and the script exits non-zero.
+# Every MAINTAINERS file in the tree is checked (the top-level one plus the
+# per-board/per-driver MAINTAINERS files). All F: paths are interpreted
+# relative to the repository root and are treated as shell globs, matching the
+# way MAINTAINERS wildcards work. If a pattern matches no existing file or
+# directory it is reported and the script exits non-zero.
set -u
-MAINTAINERS="${1:-MAINTAINERS}"
+# Move to the repository root so that F: globs (which are root relative)
+# resolve correctly regardless of where the script is invoked from.
+if root=$(git rev-parse --show-toplevel 2>/dev/null); then
+ cd "$root" || exit 2
+fi
-if [ ! -f "$MAINTAINERS" ]; then
- echo "error: cannot find $MAINTAINERS" >&2
- exit 2
+# Collect the list of MAINTAINERS files to check. Newlines separate entries;
+# MAINTAINERS paths never contain spaces.
+set -f
+IFS='
+'
+if list=$(git ls-files '*MAINTAINERS' 'MAINTAINERS' 2>/dev/null) && [ -n "$list" ]; then
+ set -- $list
+else
+ # Fall back to a filesystem search if git is unavailable.
+ set -- $(find . -name MAINTAINERS -type f | sed 's,^\./,,')
fi
+unset IFS
+set +f
rc=0
-while IFS= read -r pattern; do
- # Strip the "F:" prefix and surrounding whitespace.
- pattern=$(printf '%s\n' "$pattern" | sed -e 's/^F:[[:space:]]*//' -e 's/[[:space:]]*$//')
- [ -n "$pattern" ] || continue
-
- # Expand the pattern as a glob; if nothing matches the glob stays literal.
- matched=0
- for path in $pattern; do
- if [ -e "$path" ]; then
- matched=1
- break
+for maint in "$@"; do
+ [ -f "$maint" ] || continue
+
+ # Skip Buildman's test fixtures, whose F: paths are relative to the
+ # test setup rather than the repository root.
+ case "$maint" in
+ tools/buildman/*) continue ;;
+ esac
+
+ while IFS= read -r pattern; do
+ # Strip the "F:" prefix and surrounding whitespace, then drop the
+ # backslashes MAINTAINERS uses to escape regex-special characters
+ # (e.g. "board/k\+p/") so the pattern can be used as a plain glob.
+ pattern=$(printf '%s\n' "$pattern" | sed -e 's/^F:[[:space:]]*//' -e 's/[[:space:]]*$//' -e 's/\\\(.\)/\1/g')
+ [ -n "$pattern" ] || continue
+
+ matched=0
+ for path in $pattern; do
+ if [ -e "$path" ]; then
+ matched=1
+ break
+ fi
+ done
+
+ if [ "$matched" -eq 0 ]; then
+ echo "error: $maint references non-existing file: $pattern" >&2
+ rc=1
fi
- done
-
- if [ "$matched" -eq 0 ]; then
- echo "error: MAINTAINERS references non-existing file: $pattern" >&2
- rc=1
- fi
-done <<EOF
-$(grep '^F:' "$MAINTAINERS")
+ done <<EOF
+$(grep '^F:' "$maint")
EOF
+done
if [ "$rc" -eq 0 ]; then
echo "All MAINTAINERS F: entries exist."
--
2.43.0
next prev parent reply other threads:[~2026-08-29 1:50 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-29 1:50 [PATCH v2 0/7] Cleanup MAINTAINERS entries Tom Rini
2026-08-29 1:50 ` Tom Rini [this message]
2026-08-29 1:50 ` [PATCH v2 2/7] MAINTAINERS: tegra: Update and correct entries Tom Rini
2026-08-29 15:13 ` Svyatoslav Ryhel
2026-08-29 15:54 ` Tom Rini
2026-08-29 16:05 ` Svyatoslav Ryhel
2026-08-29 16:12 ` Tom Rini
2026-08-29 1:50 ` [PATCH v2 3/7] MAINTAINERS: rockchip: Use N for rk3576-nanopi-r76s Tom Rini
2026-08-29 1:50 ` [PATCH v2 4/7] MAINTAINERS: Fix "typo" and similar incorrect entries Tom Rini
2026-08-29 1:50 ` [PATCH v2 5/7] MAINTAINERS: Correct entries missed during renames Tom Rini
2026-08-29 1:50 ` [PATCH v2 6/7] MAINTAINERS: Removed files Tom Rini
2026-08-29 20:16 ` Tony Dinh
2026-08-31 6:40 ` Michal Simek
2026-08-31 15:16 ` Tom Rini
2026-08-31 15:32 ` Michal Simek
2026-08-29 1:50 ` [PATCH v2 7/7] CI: Run scripts/check_maintainers_files.sh in the existing MAINTAINERS job Tom Rini
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=20260829015026.473134-2-trini@konsulko.com \
--to=trini@konsulko.com \
--cc=michal.simek@amd.com \
--cc=u-boot@lists.u-boot-project.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.