check-package: Flag usage of '\t \\$'.
authorNicolas Cavallari <nicolas.cavallari@green-communications.fr>
Wed, 7 Mar 2018 09:48:12 +0000 (10:48 +0100)
committerThomas Petazzoni <thomas.petazzoni@bootlin.com>
Sat, 31 Mar 2018 21:02:14 +0000 (23:02 +0200)
check-package would flag tabs before a backslash ('\t\\'),
two spaces before a backslash ('  \\') but would not flag a tab before space
before backslash ('\t \\'), allowing someone to bypass the check.

Signed-off-by: Nicolas Cavallari <nicolas.cavallari@green-communications.fr>
Reviewed-by: Ricardo Martincoski <ricardo.martincoski@datacom.ind.br>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
utils/checkpackagelib/lib_mk.py

index 2df2e1a8842ae70a42fca9611cf866b8079810ba..cfd4d0511758f3aee53684445bb92457a2640768 100644 (file)
@@ -123,7 +123,7 @@ class RemoveDefaultPackageSourceVariable(_CheckFunction):
 
 
 class SpaceBeforeBackslash(_CheckFunction):
-    TAB_OR_MULTIPLE_SPACES_BEFORE_BACKSLASH = re.compile(r"^.*(  |\t)\\$")
+    TAB_OR_MULTIPLE_SPACES_BEFORE_BACKSLASH = re.compile(r"^.*(  |\t ?)\\$")
 
     def check_line(self, lineno, text):
         if self.TAB_OR_MULTIPLE_SPACES_BEFORE_BACKSLASH.match(text.rstrip()):