-
-
Notifications
You must be signed in to change notification settings - Fork 848
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
Option --path-separator
failing on MSys (Git Bash)
#537
Comments
It looks to me like this is a problem of Msys2 or Git Bash. Could you please try these suggestions: https://stackoverflow.com/a/54924640/704831 ? |
Thank you, that was a great hint, @sharkdp! I am very grateful to you for taking the time to dig into this. For the record, one needs to set the environment variable $ fd --path-separator='/'
bar
barC:/Program Files/Git/baz
barC:/Program Files/Git/bazC:/Program Files/Git/bla
barC:/Program Files/Git/bazC:/Program Files/Git/blaC:/Program Files/Git/some.txt
barC:/Program Files/Git/yetanother.txt
other.txt
$ MSYS_NO_PATHCONV=1 fd --path-separator='/'
bar
bar/baz
bar/baz/bla
bar/baz/bla/some.txt
bar/yetanother.txt
other.txt |
This |
Given that we introduced the Maybe we should introduce a What do you think? |
Good idea! |
Okay, let's turn this into a feature request. |
I ran into this today trying to use fd on msys2, and just learned about MSYS2_ARG_CONV_EXCL so maybe I can fix my shell alias. Could fd go a step further and try to auto-detect the path separator at runtime?
|
Unlike cygwin, msys automatically converts paths, so we don't need a shell wrapper function to translate things with `cygpath -w`. Additionally, msys sees --path-separator=/ and turns the / into "C:\", which is even worse. Hack around this by checking the $MSYSTEM environment variable and automatically setting the path separator accordingly. See sharkdp#537
@aswild Great idea. Maybe this could help for cygwin: https://stackoverflow.com/a/3104453 ? |
Ooh, OSTYPE looks so promising but apparently it's only set as a shell variable and isn't exported to the environment, foiled again. |
It would be great if someone could summarize the current status and what should/could be done here to improve the situation. |
I haven't used I think it's OK to leave it unchanged since I already give the workaround in |
My current view of the world:
What could fd do?
|
A PR would be very much appreciated - thank you! |
MSYS and MSYS2 environments (such as Git Bash) have a UNIX like filesystem which uses '/' as the path separator rather than '\', but Rust doesn't know about this by default. On Windows, check the MSYSTEM environment variable and set the default value of the --path-separator option to '/' for convenience. There is no similar detection of Cygwin because there seems to be no way for Rust (and any native Win32) programs to detect that they're being called from a Cygwin environment. Cygwin users can use a shell alias/function/script to wrap fd. Fixes: sharkdp#537
MSYS and MSYS2 environments (such as Git Bash) have a UNIX like filesystem which uses '/' as the path separator rather than '\', but Rust doesn't know about this by default. On Windows, check the MSYSTEM environment variable and set the default value of the --path-separator option to '/' for convenience. There is no similar detection of Cygwin because there seems to be no way for Rust (and any native Win32) programs to detect that they're being called from a Cygwin environment. Cygwin users can use a shell alias/function/script to wrap fd. Fixes: sharkdp#537
MSYS and MSYS2 environments (such as Git Bash) have a UNIX like filesystem which uses '/' as the path separator rather than '\', but Rust doesn't know about this by default. On Windows, check the MSYSTEM environment variable and set the default value of the --path-separator option to '/' for convenience. There is no similar detection of Cygwin because there seems to be no way for Rust (and any native Win32) programs to detect that they're being called from a Cygwin environment. Cygwin users can use a shell alias/function/script to wrap fd. Fixes: sharkdp#537
MSYS and MSYS2 environments (such as Git Bash) have a UNIX like filesystem which uses '/' as the path separator rather than '\', but Rust doesn't know about this by default. On Windows, check the MSYSTEM environment variable and set the default value of the --path-separator option to '/' for convenience. There is no similar detection of Cygwin because there seems to be no way for Rust (and any native Win32) programs to detect that they're being called from a Cygwin environment. Cygwin users can use a shell alias/function/script to wrap fd. Fixes: #537
I have fd 7.4.0 installed on a Windows machine (Rust 1.41.0, stable-x86_64-pc-windows-msvc) and run it from a bash that is provided by Git for Windows, which itself is based on Msys2 (according to https://github.com/git-for-windows/git/wiki/Technical-overview):
fd is using backslashes as it is supposed to do in Windows. #429 added the
--path-separator
option, which could be useful for using the results as paths within Git Bash. However, in my environment, the option fails, and every backslash is substituted with the absolute path to the Git for Windows installation directory:Using single-quotes around the slash character make no difference. Nor does leaving out the quotes all together.
The text was updated successfully, but these errors were encountered: