diff options
-rw-r--r-- | lib/bb/data_smart.py | 8 | ||||
-rw-r--r-- | lib/bb/tests/data.py | 5 |
2 files changed, 9 insertions, 4 deletions
diff --git a/lib/bb/data_smart.py b/lib/bb/data_smart.py index 43e9e7855..65528c6ae 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 if flag == "_content" and local_var is not None and ":prepend" in local_var and not parsing: - if not value: - value = "" self.need_overrides() for (r, o) in local_var[":prepend"]: @@ -774,6 +772,8 @@ class DataSmart(MutableMapping): if not o2 in self.overrides: match = False if match: + if value is None: + value = "" value = r + value parser = None diff --git a/lib/bb/tests/data.py b/lib/bb/tests/data.py index 7f1d3ffbb..e667c7c7d 100644 --- a/lib/bb/tests/data.py +++ b/lib/bb/tests/data.py @@ -405,6 +405,11 @@ class TestOverrides(unittest.TestCase): bb.data.expandKeys(self.d) self.assertEqual(self.d.getVar("VERSION"), "2") + def test_append_and_unused_override(self): + # Had a bug where an unused override append could return "" instead of None + self.d.setVar("BAR:append:unusedoverride", "testvalue2") + self.assertEqual(self.d.getVar("BAR"), None) + class TestKeyExpansion(unittest.TestCase): def setUp(self): self.d = bb.data.init() |