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 v3 3/3] scripts: kconfig: merge_config.sh: warn on duplicate input files
Date: Thu, 22 Jan 2026 12:57:51 +0200 [thread overview]
Message-ID: <20260122105751.2186609-3-mikko.rapeli@linaro.org> (raw)
In-Reply-To: <20260122105751.2186609-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(+)
v3: no changes
v2: no changes
https://lore.kernel.org/linux-kbuild/20251229114447.45236-1-mikko.rapeli@linaro.org/T/#me2023dbfef124059bd906d44c60ffaa7cd83732c
v1: https://lore.kernel.org/linux-kbuild/20251229114447.45236-1-mikko.rapeli@linaro.org/T/#t
diff --git a/scripts/kconfig/merge_config.sh b/scripts/kconfig/merge_config.sh
index 9eda9dbd4542..735e1de450c6 100755
--- a/scripts/kconfig/merge_config.sh
+++ b/scripts/kconfig/merge_config.sh
@@ -130,6 +130,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"
@@ -137,6 +139,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" \
@@ -259,6 +269,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:[~2026-01-22 10:58 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-22 10:57 [PATCH v3 1/3] scripts: kconfig: merge_config.sh: refactor from shell/sed/grep to awk Mikko Rapeli
2026-01-22 10:57 ` [PATCH v3 2/3] scripts: kconfig: merge_config.sh: use awk in checks too Mikko Rapeli
2026-01-22 10:57 ` Mikko Rapeli [this message]
2026-01-30 0:10 ` [PATCH v3 1/3] scripts: kconfig: merge_config.sh: refactor from shell/sed/grep to awk Nathan Chancellor
2026-03-09 16:38 ` Andreas Larsson
2026-03-09 17:09 ` Nathan Chancellor
2026-03-10 7:50 ` Mikko Rapeli
2026-03-10 9:55 ` Andreas Larsson
2026-03-10 10:01 ` Mikko Rapeli
2026-03-10 10:25 ` Andreas Larsson
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=20260122105751.2186609-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®