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

vfox activate bash breaks path on Windows #172

Closed
jcrben opened this issue Apr 3, 2024 · 3 comments
Closed

vfox activate bash breaks path on Windows #172

jcrben opened this issue Apr 3, 2024 · 3 comments
Assignees
Labels
bug Something isn't working
Milestone

Comments

@jcrben
Copy link

jcrben commented Apr 3, 2024

Version
vfox 0.3.0
OS
Windows - bash (not quite gitbash but close - cygwin/msys2 bash)

Describe the bug
eval "$(vfox activate bash)" breaks my PATH

Before, my PATH looked like this:

/c/Program Files/Oracle/VirtualBox:/c/Users/Ben/.cache/fnm_multishells/11528_1712109171427:/c/Users/Ben/code//bin:/c/Users/Ben/.local/yarn/bin:/c/Users/Ben/~/.nix-profile/bin:/c/Users/Ben/myutils/mybin:/c/Users/Ben/.local/mybin:/usr/local/opt/openssl/bin:/c/Users/Ben/bin:/usr/local/bin:/usr/bin:/bin:/opt/bin:/c/Program Files (x86)/VMware/VMware Player/bin:/c/WINDOWS/system32:/c/WINDOWS:/c/WINDOWS/System32/Wbem:/c/WINDOWS/System32/WindowsPowerShell/v1.0:/c/WINDOWS/System32/OpenSSH:/c/Program Files/Intel/WiFi/bin:/c/Program Files/Common Files/Intel/WirelessCommon:/cmd:/c/Program Files/PowerShell/7:/c/Users/Ben/scoop/apps/jbang/current/bin:/c/Users/Ben/code/bin:/c/Users/Ben/scoop/apps/python/current/Scripts:/c/Users/Ben/scoop/apps/python/current:/c/Users/Ben/scoop/apps/imagemagick/current:/c/Users/Ben/scoop/apps/dotnet6-sdk/current:/c/Users/Ben/scoop/apps/wingetui/current/choco-cli/bin:/c/Users/Ben/scoop/shims:/c/Users/Ben/AppData/Local/Microsoft/WindowsApps:/c/Program Files/Multipass/bin:/c/Users/Ben/AppData/Local/Programs/Microsoft VS Code/bin:/c/Users/Ben/.local/bin:/c/Users/Ben/.dotnet/tools:/usr/bin/vendor_perl:/usr/bin/core_perl

After:

Ben@t480-ben ~$ echo $PATH /c/Program Files/Oracle/VirtualBox:C:/Users/Ben/.cache/fnm_multishells/22788_1712111709737:C:/Users/Ben/code/bin:C:/Users/Ben/.local/yarn/bin:C:/Users/Ben/~/.nix-profile/bin:C:/Users/Ben/myutils/mybin:C:/Users/Ben/.local/mybin:C:/Program Files/Git/usr/local/opt/openssl/bin:C:/Users/Ben/bin:C:/Program Files/Git/usr/local/bin:C:/Program Files/Git/usr/bin:C:/Program Files/Git/opt/bin:C:/Program Files (x86)/VMware/VMware Player/bin:C:/WINDOWS/system32:C:/WINDOWS:C:/WINDOWS/System32/Wbem:C:/WINDOWS/System32/WindowsPowerShell/v1.0:C:/WINDOWS/System32/OpenSSH:C:/Program Files/Intel/WiFi/bin:C:/Program Files/Common Files/Intel/WirelessCommon:C:/Program Files/Git/cmd:C:/Program Files/PowerShell/7:C:/Users/Ben/scoop/apps/jbang/current/bin:C:/Users/Ben/scoop/apps/python/current/Scripts:C:/Users/Ben/scoop/apps/python/current:C:/Users/Ben/scoop/apps/imagemagick/current:C:/Users/Ben/scoop/apps/dotnet6-sdk/current:C:/Users/Ben/scoop/apps/wingetui/current/choco-cli/bin:C:/Users/Ben/scoop/shims:C:/Users/Ben/AppData/Local/Microsoft/WindowsApps:C:/Program Files/Multipass/bin:C:/Users/Ben/AppData/Local/Programs/Microsoft VS Code/bin:C:/Users/Ben/.local/bin:C:/Users/Ben/.dotnet/tools:C:/Program Files/Git/usr/bin/vendor_perl:C:/Program Files/Git/usr/bin/core_perl direnv: error can't find bash: exec: "bash": executable file not found in %PATH% bash: cygpath: command not found

It's adding C:/

vfox activate bash should use cygpath -u to create a unix-style PATH

I'm using bash via the Windows Terminal - I'm technically using the msys2 version (with UNIX signals respected) - my Windows Terminal profile config looks like this:

            {
                "commandline": "%PROGRAMFILES%/Git/usr/bin/bash.exe -i -l",
                "guid": "{00000000-0000-0000-ba54-000000000002}",
                "icon": "%PROGRAMFILES%/Git/mingw64/share/git/git-for-windows.ico",
                "name": "Bash",
                "startingDirectory": "%USERPROFILE%"
            },

Screenshots[optional]
If applicable, add screenshots to help explain your problem.

@jcrben jcrben added the bug Something isn't working label Apr 3, 2024
@aooohan aooohan self-assigned this Apr 3, 2024
@aooohan
Copy link
Member

aooohan commented Apr 3, 2024

I have supported gitbash before, so the C:/ drive letter was not processed as gitbash processed it internally. We need to do some processing on the path...

@jcrben
Copy link
Author

jcrben commented Apr 3, 2024

You just need to make sure all the PATH entries follow cygpath -u style. MSYS2 bash (used in gitbash) reports $OSTYPE of msys btw

@aooohan aooohan closed this as completed in 7d1abf3 Apr 3, 2024
@jcrben
Copy link
Author

jcrben commented Apr 5, 2024

Built from source and works great, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants