Whole file

espressif/esp-idf-kconfig

The author described this change as fix: enhance error message if envvar is misused in source option. It counts as a record because the check below fails on the code as it stood at 031bafc9b and passes on 34c0a8cb4, with nothing else changed between the two runs.

Fix saved2025-09-04
Sharing licenceApache-2.0 · LICENSE
Change size+16 3

What the code was meant to do, written into the code itself as a save note

fix: enhance error message if envvar is misused in source option

The change

8888 )
8989 path = m.group(2)
9090 filename = os.path.basename(path)
91- if path in [
91+ allowed_envvars = [
9292 "$COMPONENT_KCONFIGS_SOURCE_FILE",
9393 "$COMPONENT_KCONFIGS_PROJBUILD_SOURCE_FILE",
9494 "$COMPONENT_KCONFIGS_EXCLUDED_SOURCE_FILE",
9595 "$COMPONENT_KCONFIGS_PROJBUILD_EXCLUDED_SOURCE_FILE",
96- ]:
97- pass
96+ ]
97+ # skip the rest of the checks for variables that do not need to explicitly specify file name
98+ if path in allowed_envvars:
99+ return
100+ # path == filename means path is only an env_var, without file name explicitly mentioned
101+ if path.startswith("$") and path == filename:
102+ raise InputError(
103+ self.path_in_idf,
104+ line_number,
105+ (
106+ "environment variables cannot specify the filename in sourced files, only the path. "
107+ 'Specify the filename explicitly ("$ENV_VAR/Kconfig.<suffix>").'
108+ ),
109+ line.replace(path, os.path.join(path, "Kconfig.<suffix>")),
110+ )
98111 elif not filename.startswith("Kconfig."):
99112 raise InputError(
100113 self.path_in_idf,

The check that tells the two apart

failpass·test/kconfcheck/test_kconfcheck.py::TestSourceChecker::test_source_file_name

Check file test/kconfcheck/test_kconfcheck.py, taken without changes from the fix and copied onto the older code, so the exact same check runs against both versions.

Origin and history

The code before it031bafc9b49ce2ae8dfb1f88f75e5b6942b60ca2
Broken version dated2025-09-04
Modulekconfcheck.core
Units changedSourceChecker
Fingerprint006ed9940c7477cf
Checked2026-08-18 by goldset/0.1

Every field above is generated by our program. None of it is written by hand.