java-topology/defects/salt/patch/salt-0002-thin-tops-set-dedup.patch

13 lines
713 B
Diff

# UNDF: UNDF-2026-000000725
--- a/salt/utils/thin.py
+++ b/salt/utils/thin.py
@@ -840,7 +840,9 @@ def gen_thin(cachedir, extra_mods="", so_mods="", ...):
mods, saltext_dists = _discover_saltexts(
allowlist=saltext_allowlist, blocklist=saltext_blocklist
)
- # Deduplicate in case some saltexts were passed in thin_extra_modules
- tops.extend(mod for mod in mods if mod not in tops)
+ # Deduplicate in case some saltexts were passed in thin_extra_modules.
+ # Use a set for O(1) membership checks instead of O(N) list scans.
+ tops_set = set(tops)
+ tops.extend(mod for mod in mods if mod not in tops_set)