[yocto] [layerindex-web][PATCH] Fix broken regex for recipes with names containing + signs

Paul Eggleton paul.eggleton at linux.intel.com
Mon Oct 1 15:47:14 PDT 2018


In order to show bbappends on the recipe detail page we are doing a
regex query to find any whose names match up with the recipe. In the
layer index instance at layers.openembedded.org viewing the recipe
detail page for any recipe whose name contains ++ (e.g. libsigc++-2.0 in
meta-oe) results in an invalid regex and causes a database error. Escape
any + signs in the name used within the regex in order to fix this.

(I wasn't actually able to reproduce this on my own setup despite also
using MariaDB, but I did find that the unescaped query was not correctly
matching records so it needed to be fixed anyway.)

Signed-off-by: Paul Eggleton <paul.eggleton at linux.intel.com>
---
 layerindex/views.py | 1 +
 1 file changed, 1 insertion(+)

diff --git a/layerindex/views.py b/layerindex/views.py
index 4eed0cef..5ac7ffab 100644
--- a/layerindex/views.py
+++ b/layerindex/views.py
@@ -869,6 +869,7 @@ class RecipeDetailView(DetailView):
         if recipe:
             verappendprefix = recipe.filename.split('.bb')[0]
             appendprefix = verappendprefix.split('_')[0]
+            appendprefix = appendprefix.replace('+', r'\+')
             #context['verappends'] = BBAppend.objects.filter(layerbranch__branch=recipe.layerbranch.branch).filter(filename='%s.bbappend' % verappendprefix)
             context['appends'] = BBAppend.objects.filter(layerbranch__branch=recipe.layerbranch.branch).filter(filename__regex=r'^%s(_[^_]*)?\.bbappend' % appendprefix)
             verappends = []
-- 
2.17.1



More information about the yocto mailing list