Skip to contentSkip to conversation

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

PATCH Kyle Russell 1 participant 1 message Feb 17, 2020

lore
Share & tools
lore
#0 lore raw

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.

---
 lib/bb/data_smart.py | 4 ++++
 1 file changed, 4 insertions(+)
lib/bb/data_smart.py +4 -0
index dd5c6185..63a32bc6 100644
@@ -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)
Signature · 1 line
2.17.1