Re: [PATCH] data_smart: Fix inactive overide accidental variable value corruption

Richard Purdie

On Tue, 2021-08-03 at 08:39 +0000, Peter Kjellerstedt wrote:
-----Original Message-----
From: bitbake-devel@... <bitbake-
devel@...> On Behalf Of Richard Purdie
Sent: den 2 augusti 2021 17:42
To: bitbake-devel@...
Subject: [bitbake-devel] [PATCH] data_smart: Fix inactive overide
accidental variable value corruption

Setting something like:


should cause BAR to be None, not "" which was what the datastore was
returning. This caused problems when mixing variables like:


since key expansion would report key overlap when there was none. This
is a bug in the datastore. Fix it and add a test too.

[YOCTO #14088]

Signed-off-by: Richard Purdie <richard.purdie@...>
 lib/bb/ | 8 ++++----
 lib/bb/tests/ | 5 +++++
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/lib/bb/ b/lib/bb/
index 43e9e78555..65528c6ae6 100644
--- a/lib/bb/
+++ b/lib/bb/
@@ -750,8 +750,6 @@ class DataSmart(MutableMapping):

         if flag == "_content" and local_var is not None and ":append" in local_var and not parsing:
- if not value:
- value = ""
             for (r, o) in local_var[":append"]:
                 match = True
@@ -760,11 +758,11 @@ class DataSmart(MutableMapping):
                         if not o2 in self.overrides:
                             match = False
                 if match:
+ if value is None:
+ value = ""
                     value = value + r
Minor detail, but at least I find this more readable:
That isn't quite the same thing though as for example what if value was 

You'd hope that we didn't have such situations but I coded it that way so
it would cause an error if it occurred, being explicit about the case we
need to handle.



Join { to automatically receive all group messages.