summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2024-07-25 09:02:01 -0700
committerEli Schwartz <eschwartz93@gmail.com>2024-07-25 14:10:20 -0400
commit4842b8bcb37fe98f48b08e99210e04640380bffb (patch)
tree66d25d6efeea6ad5ef85c59a812d53c6d6977114
parentf009ccb81bde95a414ca071aadfe24b44b39398b (diff)
downloadmeson-4842b8bcb37fe98f48b08e99210e04640380bffb.tar.gz
backend/ninja: fix off-by-one in cmd length estimate
This causes us to not count the spaces between arguments, thereby undercounting the number of elements. This is extra important because we previously double counted all actual characters, covering this issue up. Fixes: cf0fecfce ("backend/ninja: Fix bug in NinjaRule.length_estimate")
-rw-r--r--mesonbuild/backend/ninjabackend.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py
index e1c6d0ca8..552ddee12 100644
--- a/mesonbuild/backend/ninjabackend.py
+++ b/mesonbuild/backend/ninjabackend.py
@@ -292,7 +292,7 @@ class NinjaRule:
estimate = len(command)
for m in re.finditer(r'(\${\w+}|\$\w+)?[^$]*', command):
if m.start(1) != -1:
- estimate -= m.end(1) - m.start(1) + 1
+ estimate -= m.end(1) - m.start(1)
chunk = m.group(1)
if chunk[1] == '{':
chunk = chunk[2:-1]