From: Mikko Rapeli <mikko.rapeli@linaro.org>
To: Nathan Chancellor <nathan@kernel.org>,
Nicolas Schier <nsc@kernel.org>,
Anders Roxell <anders.roxell@linaro.org>,
linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Mikko Rapeli <mikko.rapeli@linaro.org>
Subject: [PATCH 3/3] scripts: kconfig: merge_config.sh: warn on duplicate input files
Date: Mon, 29 Dec 2025 13:44:47 +0200 [thread overview]
Message-ID: <20251229114447.45236-3-mikko.rapeli@linaro.org> (raw)
In-Reply-To: <20251229114447.45236-1-mikko.rapeli@linaro.org>
External scripts like yocto kernel scc may provide
same input config fragment multiple times. This may
be a bug since processing same fragments multiple times
can be time consuming.
Cc: Anders Roxell <anders.roxell@linaro.org>
Signed-off-by: Mikko Rapeli <mikko.rapeli@linaro.org>
---
scripts/kconfig/merge_config.sh | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/scripts/kconfig/merge_config.sh b/scripts/kconfig/merge_config.sh
index bc6b5d0a69bc..0996bf118325 100755
--- a/scripts/kconfig/merge_config.sh
+++ b/scripts/kconfig/merge_config.sh
@@ -128,6 +128,8 @@ trap clean_up EXIT
cat $INITFILE > $TMP_FILE
+PROCESSED_FILES=""
+
# Merge files, printing warnings on overridden values
for ORIG_MERGE_FILE in $MERGE_LIST ; do
echo "Merging $ORIG_MERGE_FILE"
@@ -135,6 +137,14 @@ for ORIG_MERGE_FILE in $MERGE_LIST ; do
echo "The merge file '$ORIG_MERGE_FILE' does not exist. Exit." >&2
exit 1
fi
+
+ # Check for duplicate input files
+ case " $PROCESSED_FILES " in
+ *" $ORIG_MERGE_FILE "*)
+ ${WARNOVERRIDE} "WARNING: Input file provided multiple times: $ORIG_MERGE_FILE"
+ ;;
+ esac
+
# Use awk for single-pass processing instead of per-symbol grep/sed
if ! awk -v prefix="$CONFIG_PREFIX" \
-v warnoverride="$WARNOVERRIDE" \
@@ -256,6 +266,7 @@ for ORIG_MERGE_FILE in $MERGE_LIST ; do
STRICT_MODE_VIOLATED=true
fi
mv "${TMP_FILE}.new" "$TMP_FILE"
+ PROCESSED_FILES="$PROCESSED_FILES $ORIG_MERGE_FILE"
done
if [ "$STRICT_MODE_VIOLATED" = "true" ]; then
echo "The fragment redefined a value and strict mode had been passed."
--
2.34.1
next prev parent reply other threads:[~2025-12-29 11:45 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-29 11:44 [PATCH 1/3] scripts: kconfig: merge_config.sh: refactor from shell/sed/grep to awk Mikko Rapeli
2025-12-29 11:44 ` [PATCH 2/3] scripts: kconfig: merge_config.sh: use awk in checks too Mikko Rapeli
2025-12-29 11:44 ` Mikko Rapeli [this message]
2025-12-30 20:55 ` [PATCH 1/3] scripts: kconfig: merge_config.sh: refactor from shell/sed/grep to awk Nathan Chancellor
2025-12-31 7:50 ` Mikko Rapeli
2025-12-31 8:40 ` [PATCH v2 " Mikko Rapeli
2025-12-31 8:40 ` [PATCH v2 2/3] scripts: kconfig: merge_config.sh: use awk in checks too Mikko Rapeli
2025-12-31 8:40 ` [PATCH v2 3/3] scripts: kconfig: merge_config.sh: warn on duplicate input files Mikko Rapeli
2026-01-11 1:23 ` [PATCH v2 1/3] scripts: kconfig: merge_config.sh: refactor from shell/sed/grep to awk Nathan Chancellor
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=20251229114447.45236-3-mikko.rapeli@linaro.org \
--to=mikko.rapeli@linaro.org \
--cc=anders.roxell@linaro.org \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nathan@kernel.org \
--cc=nsc@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®