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

Shebang cannot be overridden by machine file #12369

Open
QuLogic opened this issue Oct 13, 2023 · 0 comments
Open

Shebang cannot be overridden by machine file #12369

QuLogic opened this issue Oct 13, 2023 · 0 comments
Labels
bug machine files Cross and Native files OS:windows Winodows OS specific issues

Comments

@QuLogic
Copy link
Member

QuLogic commented Oct 13, 2023

Describe the bug
On Windows, Meson can automatically run a script by parsing the interpreter out of the shebang line, which is pretty convenient. But unlike compilers, it does not seem that this can be overridden in a machine file. This is the first part of #12346

To Reproduce
With this meson.build:

project('shell')

example = find_program('example.sh')

result = run_command(example, capture: true, check: true)

message(result)

this example.sh:

#!/bin/foo

echo "Example"

and this native.ini:

[binaries]
foo = 'c:\\program files\\git\\bin\\bash.exe'

running as:

> meson setup --native-file native.ini build

This fails to configure:

The Meson build system
Version: 1.2.1
Source dir: C:\Users\quant\shell
Build dir: C:\Users\quant\shell\build
Build type: native build
Project name: shell
Project version: undefined
Host machine cpu family: x86_64
Host machine cpu: x86_64
Program example.sh found: YES (foo C:\Users\quant\shell\example.sh)

meson.build:5:9: ERROR: Could not execute command `foo C:\Users\quant\shell\example.sh`.

A full log can be found at C:\Users\quant\shell\build\meson-logs\meson-log.txt

Expected behavior
Running the script directly with the shell from the native file works:

"c:\program files\git\bin\bash.exe" example.sh
Example

and I'd expect the same to happen in Meson.

system parameters

  • Is this a cross build or just a plain native build (for the same computer)? Native
  • what operating system? Windows 11
  • what Python version? Whatever is bundled in the MSI
  • what meson --version? 1.2.1
  • what ninja --version if it's a Ninja build? N/A
@QuLogic QuLogic added OS:windows Winodows OS specific issues machine files Cross and Native files bug labels Oct 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug machine files Cross and Native files OS:windows Winodows OS specific issues
Projects
None yet
Development

No branches or pull requests

1 participant