[bitbake-devel] [][PATCH] bitbake: don't allow renameVar calls with equivalent keys

Kyle Russell bkylerussell at gmail.com
Mon Feb 17 15:25:52 UTC 2020


While usually a programming error, the behavior can cause a Parser
instance to eventually gobble up a significant amount of memory,
greatly affecting system performance.  Try to avoid getting into
that situation and alert the user about what they attempted to do.

Signed-off-by: Kyle Russell <bkylerussell at gmail.com>
---
 lib/bb/data_smart.py | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/lib/bb/data_smart.py b/lib/bb/data_smart.py
index dd5c6185..63a32bc6 100644
--- a/lib/bb/data_smart.py
+++ b/lib/bb/data_smart.py
@@ -607,6 +607,10 @@ class DataSmart(MutableMapping):
         """
         Rename the variable key to newkey
         """
+        if key == newkey:
+            bb.warn("Calling renameVar with equivalent keys (%s) is invalid" % key)
+            return
+
         if '_remote_data' in self.dict:
             connector = self.dict["_remote_data"]["_content"]
             res = connector.renameVar(key, newkey)
-- 
2.17.1



More information about the bitbake-devel mailing list