question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

msys2 command line argument syntax

See original GitHub issue

I’ve been using msys2 to build Python wheels in python-flint and it works excellently so many thanks!

I did have one issue though that was awkward (at the time) to diagnose and fix and i wonder if there is a better way to solve this in general. The problem is that I wanted to call msys2 and ask it to run a shell script with command line arguments that are Windows paths e.g. like:

> msys2 -c bin/myscript.sh C:\Path\To\File

The msys2 command expects a single command line argument though so it needed to be more like:

> msys2 -c "bin/myscript.sh C:\Path\To\File"

Now the problem is (I think) that msys2 parses this as bash syntax so my script ends up being called like:

$ bin/myscript.sh C:PathToFile

I could work around this with an extra batch file that turns the arguments into environment variables: https://github.com/fredrik-johansson/python-flint/blob/e08d3dfc236f6b38fcc11bcde5c621993761a806/bin/cibw_repair_wheel_command_windows.bat#L2-L5

Could there be a way to invoke the msys2 command and have it just take separate string arguments and treat them faithfully as the strings that they are? Perhaps something like:

> msys2 -cc bin/myscript.sh C:\Path\To\File

Note that I can’t just escape the slashes etc because the paths are generated indirectly: https://github.com/fredrik-johansson/python-flint/blob/e08d3dfc236f6b38fcc11bcde5c621993761a806/.github/workflows/buildwheel.yml#L52-L53

Issue Analytics

  • State:closed
  • Created 9 months ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
lazkacommented, Dec 22, 2022
0reactions
oscarbenjamincommented, Dec 22, 2022

The problem is that I’m passing command lines into another tool: https://github.com/fredrik-johansson/python-flint/blob/e08d3dfc236f6b38fcc11bcde5c621993761a806/.github/workflows/buildwheel.yml#L52-L53 I don’t think that setting the shell for GA to msys will change the way that cibuildwheel runs the commands.

Read more comments on GitHub >

github_iconTop Results From Across the Web

[BUG]: MSYS2: command line argument mangling - how to ...
Type "REG QUERY /?" for usage. $ REG QUERY /? ERROR: Invalid syntax. Type "REG QUERY /?" for usage. Something seems to be...
Read more >
MSYS2-Introduction
MSYS2 is software distribution and a building platform for Windows. It provides a Unix-like environment, a command-line interface and a software repository ...
Read more >
Executing MSYS from cmd.exe with arguments
I want my makefiles to be able to open an instance of MSYS and send the g++ command and arguments to it. Example:...
Read more >
Can Mingw32/Msys run dos/cmd.exe executables without ...
Got this working with cmd //c [command] . In MSYS a command line argument of "/c" is interpreted as the C: drive, so...
Read more >
Windows MSYS2 Setup - Lean Manual
A native Lean binary for Windows can be generated using MSYS2. ... binaries using lake build in normal Windows command prompt outside of...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found