Skip to contentSkip to conversation

cooker: detect malformed BBMASK expressions which begin with a separator

PATCH In review Andre McCurdy 1 participant 2 messages Feb 1, 2017 – Feb 15, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cooker: detect malformed BBMASK expressions which begin with a separator

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

---
 lib/bb/cooker.py | 5 +++++
 1 file changed, 5 insertions(+)
lib/bb/cooker.py +5 -0
index e654a60..ddfd4a6 100644
@@ -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)
Signature · 1 line
1.9.1
#1 lore raw
Quoted 2 lines · Andre McCurdy

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

Ping.

Quoted 24 lines
---
 lib/bb/cooker.py | 5 +++++
 1 file changed, 5 insertions(+)
lib/bb/cooker.py +5 -1
index e654a60..ddfd4a6 100644
@@ -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