-
Notifications
You must be signed in to change notification settings - Fork 490
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
Add option to disable path mangling when calling non-msys2 binaries #84
Comments
First, it would be helpful if you provide such examples that not correctly mangled to be able try fix its converting. Second, you can disable mangling some arguments with MSYS2_ARG_CONV_EXCL environment variable. This variable can contain semicolon separated list of arguments started with values that don't need to be converted. See for example: |
Unfortunately they're also essential.
Name mangling has nothing to do with Cygwin. It is the main feature that makes MSYS* different from Cygwin. |
Ah, I see. I was looking at the master branch of Alexpux/Cygwin, but I should have been looking at the develop branch. Sorry about that! The exception handling code there is clear to see, looks like that variable should be enough for my purposes. Is MSYS2_ARG_CONV_EXCL documented anywhere? A google search brought up nothing, and grep in the repository only found matches in the source code. |
We're too busy fixing bugs to document stuff, our documentation lives in the source code and places like this. In fact these github issues for MSYS2-packages and MINGW-packages are a gold mine of 'stuff'. Some useful pointers for what's what: https://github.com/Alexpux/MSYS2-packages/tree/master/msys2-runtime/ We would still like examples of paths that got mangled incorrectly if possible? We have a project in which this stuff is developed with a test suite and we'd like to add your cases to that if they are fairly unambiguously being misconverted: |
Of course you are right about documentation, so I wrote some. Would you care to review it and suggest any improvements? https://sourceforge.net/p/msys2/wiki/Contributing%20to%20MSYS2/ |
Regarding incorrectly mangled paths, those were not paths but strings that looked like paths. One was of the shape //foo/bar; that seems to work fine in a recent version of MSYS2 actually. The other was, I think, a sed expression, but I don't remember exactly. Thanks for taking this seriously, I will let you know if I come up with an interesting case of bad behavior. Also thanks a lot for adding some documentation. At least a google search for MSYS2_ARG_CONV_EXCL should now bring up something :) One question regarding MSYS2_ARG_CONV_EXCL: is there a value that would simply turn off argument mangling in all cases? I think the use case makes sense, being able to say that the caller will take care of the arguments being in the right shape. |
Not at present, we could add MSYS2_ARG_CONV_EXCL="*" as a special case I guess? |
Path mangling has been suffering some turbulence recently as we've implemented the new MSYS2 code to replace the legacy MSYS1 version we had been using. A few corner cases continue to come out of the woodwork. Hopefully that'll stop soon. |
Thanks for your work on this. |
That's done, next time msys2-runtime is released it will be included. |
I have one question concerning this: Now I suppose that I just cannot use git from MSYS2 with magit, is this true? |
Documentation for MSYS2_ARG_CONV_EXCLFor anyone who is landing on this page because it's the top Google hit for https://github.com/msys2/msys2/wiki/Porting Update: I changed the link to point to the new GitHub Wiki. |
@DavidEGrayson https://sourceforge.net/p/msys2/wiki/Porting/ is behind an auth wall. |
@573 moved here https://github.com/msys2/msys2/wiki/Porting |
Adding check-no-roundtrip is done by @masatake. NOTE: We cannot find the way to ru roundtrip on msys2. See msys2/MSYS2-packages#84 .
Adding check-no-roundtrip is done by @masatake. NOTE: We cannot find the way to ru roundtrip on msys2. See msys2/MSYS2-packages#84 .
Example of MSYS incorrectly mangling paths: docker run --rm mysql:5.7 /usr/bin/mysqldump --host=hostname--user=user--password=password-v dbname > db.sql And pretty much any other command involving docker. Docker containers expect real POSIX paths, but docker on windows is not an MSYS executable, so paths are getting mangled and the container doesn't know what to do. Example error: /usr/local/bin/docker-entrypoint.sh: line 215: /C:/Program Files/Git/usr/bin/mysqldump: No such file or directory |
There's no correct or incorrect about this I am sorry to say. At least not in general. It's a simple set of rules that are followed. This thread also explains how to disable conversion. Did I miss somethig? |
Here is an example needing a "master disable" of path mangling. $ aws ssm get-parameter --name "/subfolder/PARAMETER1" --with-decryption To AWS SSM get-parameter work, change to mangled form.This is now different than AWS CLI on any other platform including CMD and PowerShell.$ aws ssm get-parameter --name "//subfolder\PARAMETER1" --with-decryption { |
MSYS2 binaries automatically mangle arguments when calling non-MSYS binaries, applying a set of heuristics. Heuristic transformations are ugly; not being able to disable the heuristic transformations is just nasty. I've run into a few cases already in a just few days where the path mangling was causing trouble, and it is particularly annoying to have to work around.
For reference, the arguments are mangled here:
https://github.com/Alexpux/Cygwin/blob/6e95f9f5eab763ba36c8d5c62a22a4db9cca1d7f/winsup/cygwin/spawn.cc#L416
How about making it possible to disable the mangling by setting an environment variable? Something like CYGWIN_DISABLE_ARGUMENT_MANGLING=1. The environment variable would be accessible from anywhere in the code and thus should be unintrusive regarding the rest of the cygwin code, the patch should be just a couple lines.
The text was updated successfully, but these errors were encountered: