Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[meson 0.56] Cannot handle spaces in [binaries] paths / string index out of range in ninjabackend.py #7977

Closed
Neumann-A opened this issue Nov 13, 2020 · 4 comments · Fixed by #7978

Comments

@Neumann-A
Copy link
Contributor

Describe the bug

Traceback (most recent call last):
  File "E:\vcpkg_cache\downloads\tools\meson\meson-0.56.0\mesonbuild\mesonmain.py", line 140, in run
    return options.run_func(options)
  File "E:\vcpkg_cache\downloads\tools\meson\meson-0.56.0\mesonbuild\msetup.py", line 253, in run
    app.generate()
  File "E:\vcpkg_cache\downloads\tools\meson\meson-0.56.0\mesonbuild\msetup.py", line 161, in generate
    self._generate(env)
  File "E:\vcpkg_cache\downloads\tools\meson\meson-0.56.0\mesonbuild\msetup.py", line 223, in _generate
    intr.backend.generate()
  File "E:\vcpkg_cache\downloads\tools\meson\meson-0.56.0\mesonbuild\backend\ninjabackend.py", line 533, in generate
    self.write_rules(outfile)
  File "E:\vcpkg_cache\downloads\tools\meson\meson-0.56.0\mesonbuild\backend\ninjabackend.py", line 1122, in write_rules
    b.count_rule_references()
  File "E:\vcpkg_cache\downloads\tools\meson\meson-0.56.0\mesonbuild\backend\ninjabackend.py", line 342, in count_rule_references
    if self._should_use_rspfile():
  File "E:\vcpkg_cache\downloads\tools\meson\meson-0.56.0\mesonbuild\backend\ninjabackend.py", line 336, in _should_use_rspfile
    return self.rule.length_estimate(infilenames,
  File "E:\vcpkg_cache\downloads\tools\meson\meson-0.56.0\mesonbuild\backend\ninjabackend.py", line 273, in length_estimate
    if chunk[1] == '{':
IndexError: string index out of range
@Neumann-A
Copy link
Contributor Author

added a print(command) in line 269 before the for loop and a print(m) in the loop.
The output is:

"C:/Program$ Files$ (x86)/Microsoft$ Visual$ Studio/2019/Community/VC/Tools/MSVC/14.28.29333/bin/Hostx64/x64/cl.exe" $ARGS /Fo$out "/c" $in
<re.Match object; span=(0, 11), match='"C:/Program'>
<re.Match object; span=(11, 18), match='$ Files'>

@Neumann-A Neumann-A changed the title [meson 0.56] string index out of range in ninjabackend.py [meson 0.56] Cannot handle spaces in [binaries] paths / string index out of range in ninjabackend.py Nov 13, 2020
@Neumann-A
Copy link
Contributor Author

Also it worked fine with meson 0.55.1

@Neumann-A
Copy link
Contributor Author

the important parts of the native file:

[binaries]
mt = 'C:/Program Files (x86)/Windows Kits/10/bin/10.0.19041.0/x64/mt.exe'
c = 'C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.28.29333/bin/Hostx64/x64/cl.exe'
cpp = 'C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.28.29333/bin/Hostx64/x64/cl.exe'
rc = 'C:/Program Files (x86)/Windows Kits/10/bin/10.0.19041.0/x64/rc.exe'
c_ld = 'C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.28.29333/bin/Hostx64/x64/link.exe'
cpp_ld = 'C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.28.29333/bin/Hostx64/x64/link.exe'
cmake = 'C:/Program Files/CMake/bin/cmake.exe'

@Neumann-A
Copy link
Contributor Author

Neumann-A commented Nov 13, 2020

The regex should probably be:
for m in re.finditer(r'(\${\w+}|\$\w+)?[^$]*', command):
and not
for m in re.finditer(r'(\${\w*}|\$\w*)?[^$]*', command):
cc @bonzini

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant