From 1fa6012d5dc320cf5e481073ab67f0e89cbbcf88 Mon Sep 17 00:00:00 2001 From: Ramon Roche Date: Wed, 19 Aug 2026 22:58:05 -0700 Subject: [PATCH] fix(kconfig): fail when kconfig discards an assignment A .px4board line whose value does not fit its symbol's type is not an error to kconfiglib. It warns, drops the assignment, and leaves the symbol at its default, so the loaded config quietly differs from the file and no consumer downstream can tell. corvon 743v2 built with the wrong UAVCAN interface count this way, and the only trace was a warning in a job that exited 0. load_target_config() now compares kconf.warnings before and after the load and exits on any "assignment ignored", naming the file and quoting the warning. Checked against the whole tree: 293 targets load with none rejected, so this does not fail existing boards. Reintroducing the quoted value makes it exit 1 with the file path and the reason. Assisted-by: Claude:claude-opus-5 Signed-off-by: Ramon Roche --- Tools/kconfig/loadconfig.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/Tools/kconfig/loadconfig.py b/Tools/kconfig/loadconfig.py index 657e5cd9d4e..23a541d4c3f 100644 --- a/Tools/kconfig/loadconfig.py +++ b/Tools/kconfig/loadconfig.py @@ -91,8 +91,15 @@ def enumerate_targets(): def load_target_config(kconf, px4board_path): - """Load a target's config into kconf, replacing any previous state.""" + """Load a target's config into kconf, replacing any previous state. + + Exits if the file assigns a value Kconfig cannot use. kconfiglib + downgrades that to a warning and keeps the symbol's default, so the + resulting config silently differs from what the file asks for and + nothing downstream can tell. + """ label = os.path.basename(px4board_path)[:-len('.px4board')] + first_warning = len(kconf.warnings) if label in STANDALONE_LABELS: kconf.load_config(px4board_path, replace=True) else: @@ -100,6 +107,12 @@ def load_target_config(kconf, px4board_path): kconf.load_config(default_config, replace=True) kconf.load_config(px4board_path, replace=False) + ignored = [w for w in kconf.warnings[first_warning:] if 'assignment ignored' in w] + if ignored: + sys.exit('loadconfig: {}: kconfig discarded an assignment, so the config would ' + 'not match the file\n{}'.format( + px4board_path, '\n'.join(w.strip() for w in ignored))) + def chip_family(board_path): """Chip family of a board, from its NuttX defconfig.