diff mbox series

data_smart: Fix cache issues with noweakdefault getVar

Message ID 20251123161621.114056-1-richard.purdie@linuxfoundation.org
State New
Headers show
Series data_smart: Fix cache issues with noweakdefault getVar | expand

Commit Message

Richard Purdie Nov. 23, 2025, 4:16 p.m. UTC
The recently fragment error handling code uses noweakdefault=True to getVar.
Unfortunately there is a bug where the expand cache may cause that value to
ignored, giving confusing error messages.

Avoid the expand cache if that parameter is used.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
 lib/bb/data_smart.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/lib/bb/data_smart.py b/lib/bb/data_smart.py
index 2e0d3085882..110dfa11162 100644
--- a/lib/bb/data_smart.py
+++ b/lib/bb/data_smart.py
@@ -781,10 +781,10 @@  class DataSmart(MutableMapping):
                 return None
             cachename = var + "[" + flag + "]"
 
-        if not expand and retparser and cachename in self.expand_cache:
+        if not expand and retparser and cachename in self.expand_cache and not noweakdefault:
             return self.expand_cache[cachename].unexpanded_value, self.expand_cache[cachename]
 
-        if expand and cachename in self.expand_cache:
+        if expand and cachename in self.expand_cache and not noweakdefault:
             return self.expand_cache[cachename].value
 
         local_var = self._findVar(var)
@@ -904,7 +904,7 @@  class DataSmart(MutableMapping):
                 value = bb.filter.apply_filters(value, [self.filters[basevar],])
                 parser.value = value
 
-        if parser:
+        if parser and not noweakdefault:
             self.expand_cache[cachename] = parser
 
         if retparser: