Skip to contentSkip to conversation

data_smart: Fix unanchored regexp causing strange parsing issue

PATCH New Richard Purdie 1 participant 1 message Aug 3, 2012

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 data_smart: Fix unanchored regexp causing strange parsing issue

If this regular expression is unanchored, it would accept strings like:

do_install_append1
do_install_appendsomelongstring

and treat them like they were do_install_append. Clearly this isn't desirable. Only one instance of this type of issue was found in OE-Core and has been fixed so correcting the regexp should be safe to do.

---

bitbake/lib/bb/data_smart.py +1 -1
index 730deaa..31216e0 100644
@@ -39,7 +39,7 @@ from bb.COW  import COWDictBase
 logger = logging.getLogger("BitBake.Data")
 
 __setvar_keyword__ = ["_append", "_prepend"]
-__setvar_regexp__ = re.compile('(?P<base>.*?)(?P<keyword>_append|_prepend)(_(?P<add>.*))?')
+__setvar_regexp__ = re.compile('(?P<base>.*?)(?P<keyword>_append|_prepend)(_(?P<add>.*))?$')
 __expand_var_regexp__ = re.compile(r"\${[^{}]+}")
 __expand_python_regexp__ = re.compile(r"\${@.+?}")