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:
BAR:append:unusedoverride
should cause BAR to be None, not "" which was what the datastore was returning. This caused problems when mixing variables like:
RDEPENDS:${PN}:inactiveoverride RDEPENDS:${BPN}
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.
diff --git a/lib/bb/data_smart.py b/lib/bb/data_smart.py index 43e9e78555..65528c6ae6 100644 --- a/lib/bb/data_smart.py +++ b/lib/bb/data_smart.py @@ -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 = "" self.need_overrides() 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 False?
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.