[bitbake-devel] [PATCH] cooker: detect malformed BBMASK expressions which begin with a separator

Andre McCurdy armccurdy at gmail.com
Wed Feb 1 21:09:16 UTC 2017


When constructing an older style single regex, it's possible for BBMASK
to end up beginning with '|', which matches and masks _everything_.

Signed-off-by: Andre McCurdy <armccurdy at gmail.com>
---
 lib/bb/cooker.py | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/lib/bb/cooker.py b/lib/bb/cooker.py
index e654a60..ddfd4a6 100644
--- a/lib/bb/cooker.py
+++ b/lib/bb/cooker.py
@@ -1867,6 +1867,11 @@ class CookerCollectFiles(object):
             # that do not compile
             bbmasks = []
             for mask in bbmask.split():
+                # When constructing an older style single regex, it's possible for BBMASK
+                # to end up beginning with '|', which matches and masks _everything_.
+                if mask.startswith("|"):
+                    collectlog.warn("BBMASK contains regular expression beginning with '|', fixing: %s" % mask)
+                    mask = mask[1:]
                 try:
                     re.compile(mask)
                     bbmasks.append(mask)
-- 
1.9.1




More information about the bitbake-devel mailing list