From: Nicolas Schier <nsc@kernel.org>
To: Pengpeng Hou <pengpeng@iscas.ac.cn>
Cc: Nathan Chancellor <nathan@kernel.org>,
Masahiro Yamada <masahiroy@kernel.org>,
Jonathan Corbet <corbet@lwn.net>,
Shuah Khan <skhan@linuxfoundation.org>,
linux-kbuild@vger.kernel.org, linux-doc@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] kconfig: add optional warnings for changed input values
Date: Thu, 21 May 2026 20:09:58 +0200 [thread overview]
Message-ID: <ag9KdrSivC1Lp4RO@levanger> (raw)
In-Reply-To: <20260521022824.38591-1-pengpeng@iscas.ac.cn>
[-- Attachment #1: Type: text/plain, Size: 3041 bytes --]
On Thu, May 21, 2026 at 10:28:24AM +0800, Pengpeng Hou wrote:
> When reading .config input, Kconfig stores user-provided values first and
> then resolves the final value after applying dependencies, ranges, and
> other constraints.
>
> If the final value differs from the user's input, Kconfig already tracks
> that state internally, but it does not provide any focused diagnostic to
> show which explicit inputs were adjusted. This is particularly confusing
> for requested values that get forced down by unmet dependencies or
> clamped by ranges.
>
> Add an opt-in diagnostic controlled by KCONFIG_WARN_CHANGED_INPUT. Emit
> the warnings from conf_write() and conf_write_defconfig() after value
> resolution and through the existing message callback path so the default
> behavior stays unchanged and interactive frontends remain usable.
>
> Avoid the conf_message() formatting buffer for this diagnostic so long
> warning lists are not truncated before reaching the callback, and mark
> processed symbols as written before the SYMBOL_WRITE check so duplicate
> menu nodes cannot emit duplicate warnings.
>
> Document the new environment variable and add tests for both olddefconfig
> and savedefconfig.
>
> Signed-off-by: Pengpeng Hou <pengpeng@iscas.ac.cn>
> ---
> Changes since v1: https://lore.kernel.org/all/20260406233001.1-kconfig-warn-changed-input-pengpeng@iscas.ac.cn/
> - rename "found" to "changed_input_found" as suggested by Nicolas
> - avoid the conf_message() 4096-byte formatting buffer so long warning
> lists are not truncated before the callback sees them
> - mark each processed symbol as SYMBOL_WRITTEN before checking
> SYMBOL_WRITE to avoid duplicate warnings for duplicate menu nodes
> - add duplicate-definition selftest coverage
> - do not carry the Reviewed-by/Tested-by tags because v2 changes warning
> emission and duplicate suppression
>
> Documentation/kbuild/kconfig.rst | 5 +
> scripts/kconfig/confdata.c | 107 +++++++++++++++++-
> .../kconfig/tests/warn_changed_input/Kconfig | 40 +++++++
> .../tests/warn_changed_input/__init__.py | 27 +++++
> .../kconfig/tests/warn_changed_input/config | 3 +
> .../tests/warn_changed_input/expected_config | 6 +
> .../warn_changed_input/expected_defconfig | 1 +
> .../tests/warn_changed_input/expected_stdout | 4 +
> 8 files changed, 189 insertions(+), 4 deletions(-)
> create mode 100644 scripts/kconfig/tests/warn_changed_input/Kconfig
> create mode 100644 scripts/kconfig/tests/warn_changed_input/__init__.py
> create mode 100644 scripts/kconfig/tests/warn_changed_input/config
> create mode 100644 scripts/kconfig/tests/warn_changed_input/expected_config
> create mode 100644 scripts/kconfig/tests/warn_changed_input/expected_defconfig
> create mode 100644 scripts/kconfig/tests/warn_changed_input/expected_stdout
>
Thanks a lot!
Tested-by: Nicolas Schier <nsc@kernel.org>
Reviewed-by: Nicolas Schier <nsc@kernel.org>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
prev parent reply other threads:[~2026-05-21 18:10 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-21 2:28 [PATCH v2] kconfig: add optional warnings for changed input values Pengpeng Hou
2026-05-21 18:09 ` Nicolas Schier [this message]
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=ag9KdrSivC1Lp4RO@levanger \
--to=nsc@kernel.org \
--cc=corbet@lwn.net \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=masahiroy@kernel.org \
--cc=nathan@kernel.org \
--cc=pengpeng@iscas.ac.cn \
--cc=skhan@linuxfoundation.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