diff options
author | yexiaochuan <tap91624@gmail.com> | 2025-03-24 00:28:00 +0800 |
---|---|---|
committer | Eli Schwartz <eschwartz93@gmail.com> | 2025-03-26 16:08:59 -0400 |
commit | 8afce56719272bb5367c5ae304b3a935962a5391 (patch) | |
tree | a9f8d6cbf99cebd89f29e05398ba50a4db59cdcb /docs/markdown/snippets | |
parent | 1447fff171a5f6e76f9b56504f4f983a152eda79 (diff) | |
download | meson-8afce56719272bb5367c5ae304b3a935962a5391.zip meson-8afce56719272bb5367c5ae304b3a935962a5391.tar.gz meson-8afce56719272bb5367c5ae304b3a935962a5391.tar.bz2 |
envconfig: fix unhandled exception when cross-file lacks required keys
Fix the unhandled KeyError exception that occurs when cross-compilation
configuration files are missing required parameters (such as 'endian').
This issue was introduced in commit b0d2a92 (PR #11692), where the key validation
logic didn't properly handle the relationship between provided and required keys:
- Previously, the code used `set(literal) < minimum_literal` to check if provided keys
were a strict subset of the required keys in minimum_literal
- This validation logic broke down when the provided keys weren't a strict subset anymore,
but rather an overlapping set with disjoint elements on both sides
- When required keys were missing, the code continued execution and later threw
an unhandled KeyError when trying to access the non-existent keys
Changed the condition check from:
if set(literal) < minimum_literal:
to:
if minimum_literal - set(literal):
This new check specifically identifies keys that are "present in required but not present
in provided", providing users with clear error messages instead of raising unhandled
exceptions. This change also removes the implicit requirement that "provided keys must not
contain any keys not present in the required set" - allowing for optional keys to exist
in the provided configuration.
Fixes #14385
Diffstat (limited to 'docs/markdown/snippets')
0 files changed, 0 insertions, 0 deletions