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")
pull/13474/head
Dylan Baker 4 months ago committed by Eli Schwartz
parent f009ccb81b
commit 4842b8bcb3
  1. 2
      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]

Loading…
Cancel
Save