]> code.ossystems Code Review - openembedded-core.git/commitdiff
lib/oe/recipeutils: fix invalid character detection in validate_pn()
authorPaul Eggleton <paul.eggleton@linux.intel.com>
Sun, 18 Sep 2016 20:08:12 +0000 (08:08 +1200)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Mon, 19 Sep 2016 08:06:52 +0000 (09:06 +0100)
* validate_pn() is supposed to protect against invalid characters, fix
  the function so that it actually does (unanchored regex strikes
  again...)
* However, now that the function is enforcing the restrictions, we do
  still want to allow + in recipe names (e.g. "gtk+")

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/lib/oe/recipeutils.py

index a0d78dde46315752070c35165f4d5b435f65b3bd..58e4028aede074bb377dd69d4d095d77dbecca0c 100644 (file)
@@ -449,8 +449,8 @@ def get_recipe_patched_files(d):
 def validate_pn(pn):
     """Perform validation on a recipe name (PN) for a new recipe."""
     reserved_names = ['forcevariable', 'append', 'prepend', 'remove']
-    if not re.match('[0-9a-z-.]+', pn):
-        return 'Recipe name "%s" is invalid: only characters 0-9, a-z, - and . are allowed' % pn
+    if not re.match('^[0-9a-z-.+]+$', pn):
+        return 'Recipe name "%s" is invalid: only characters 0-9, a-z, -, + and . are allowed' % pn
     elif pn in reserved_names:
         return 'Recipe name "%s" is invalid: is a reserved keyword' % pn
     elif pn.startswith('pn-'):