From: Yonggang Luo Date: Wed, 26 Aug 2020 15:10:01 +0000 (+0800) Subject: ninjatool: Fixes E$$: in generated Makefile.ninja X-Git-Tag: v5.2.0-rc0~153^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=74938f0645e25f191247af55d7bf27d9c62f4768;p=thirdparty%2Fqemu.git ninjatool: Fixes E$$: in generated Makefile.ninja Even though SIMPLE_PATH_RE is used with re.match (which anchors the match implictly to the beginning of the string) it also needs an end-of-string anchor in order to match the full path token. Otherwise, the match would succeed incorrectly for $ and : characters contained in the path, for example if the path starts with C:/ or E:/. Signed-off-by: Yonggang Luo Tested-by: Mark Cave-Ayland Signed-off-by: Paolo Bonzini --- diff --git a/scripts/ninjatool.py b/scripts/ninjatool.py index c33eafb5a05..ba6bd9a2a67 100755 --- a/scripts/ninjatool.py +++ b/scripts/ninjatool.py @@ -55,7 +55,7 @@ else: PATH_RE = r"[^$\s:|]+|\$[$ :]|\$[a-zA-Z0-9_-]+|\$\{[a-zA-Z0-9_.-]+\}" -SIMPLE_PATH_RE = re.compile(r"[^$\s:|]+") +SIMPLE_PATH_RE = re.compile(r"^[^$\s:|]+$") IDENT_RE = re.compile(r"[a-zA-Z0-9_.-]+$") STRING_RE = re.compile(r"(" + PATH_RE + r"|[\s:|])(?:\r?\n)?|.") TOPLEVEL_RE = re.compile(r"([=:#]|\|\|?|^ +|(?:" + PATH_RE + r")+)\s*|.")