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

Fix Posix shell on Windows #2803

Merged
merged 1 commit into from
Sep 25, 2023
Merged

Conversation

@AntoinePrv
Copy link
Member Author

@pavelzw I investigated the generic_string that does not give a / separator on Windows.
This is another shot, but I'm not sure if we should convert to say C:/folder/file.txt or /c/folder/file.txt (the former is easier).

@AntoinePrv AntoinePrv self-assigned this Aug 31, 2023
@AntoinePrv AntoinePrv force-pushed the shell-path-cgywin branch 2 times, most recently from 448b2ff to 8ce504d Compare September 4, 2023 15:13
@AntoinePrv
Copy link
Member Author

@0xbe7a do you have time to give this a try?

@JohanMabille
Copy link
Member

Waiting for feedback from users to see if that solves the problem.

@AntoinePrv AntoinePrv merged commit a8d595b into mamba-org:main Sep 25, 2023
23 checks passed
@AntoinePrv AntoinePrv deleted the shell-path-cgywin branch September 25, 2023 12:04
@0xbe7a
Copy link
Contributor

0xbe7a commented Sep 25, 2023

Sadly it seems micromamba still does not work correctly with cygwin. I looks like it gets confused about /cygdrive/ and creates a new folder cygdrive under C:\

~ $ set -x
+ set -x
++ parse_git_branch
++ git branch
++ sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
(not_base) USERNAME@DEVICE_NAME
~ $ cat .bash_profile
+ cat .bash_profile
source ~/.bashrc
# >>> mamba initialize >>>
# !! Contents within this block are managed by 'mamba init' !!
export MAMBA_EXE='/cygdrive/c/Users/USERNAME/Downloads/micromamba.exe';
export MAMBA_ROOT_PREFIX='/cygdrive/c/Users/USERNAME/micromamba_prefix';
eval "$("$MAMBA_EXE" shell hook --shell bash --root-prefix "$MAMBA_ROOT_PREFIX")"
# <<< mamba initialize <<<
micromamba activate not_base
++ parse_git_branch
++ git branch
++ sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
(not_base) USERNAME@DEVICE_NAME
~ $ micromamba env create -n new_test_env
+ micromamba env create -n new_test_env
+ local cmd=env
+ case "${cmd}" in
+ __mamba_exe env create -n new_test_env
+ C:/Users/USERNAME/Downloads/micromamba.exe env create -n new_test_env
Empty environment created at prefix: C:\cygdrive\c\Users\USERNAME\micromamba_prefix\envs\new_test_env
++ parse_git_branch
++ git branch
++ sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
(not_base) USERNAME@DEVICE_NAME
~ $ micromamba activate new_test_env
+ micromamba activate new_test_env
+ local cmd=activate
+ case "${cmd}" in
+ __mamba_xctivate activate new_test_env
+ local ask_conda
++ PS1='(not_base) \[\e[1;35m\]\u@\h
\[\e[0;35m\]\w\[\e[0;36m\]$(parse_git_branch)\[\e[0;35m\] $ \[\e[m\]\[\e]0;\u\w\a\]'
++ __mamba_exe shell activate new_test_env --shell bash
++ C:/Users/USERNAME/Downloads/micromamba.exe shell activate new_test_env --shell bash
+ ask_conda='PS1='\''(new_test_env) \[\e[1;35m\]\u@\h
\[\e[0;35m\]\w\[\e[0;36m\]$(parse_git_branch)\[\e[0;35m\] $ \[\e[m\]\[\e]0;\u\w\a\]'\''
export PATH='\''/cygdrive/c/cygdrive/c/Users/USERNAME/micromamba_prefix/envs/new_test_env:/cygdrive/c/cygdrive/c/Users/USERNAME/micromamba_prefix/envs/new_test_env/Library/mingw-w64/bin:/cygdrive/c/cygdrive/c/Users/USERNAME/micromamba_prefix/envs/new_test_env/Library/usr/bin:/cygdrive/c/cygdrive/c/Users/USERNAME/micromamba_prefix/envs/new_test_env/Library/bin:/cygdrive/c/cygdrive/c/Users/USERNAME/micromamba_prefix/envs/new_test_env/Scripts:/cygdrive/c/cygdrive/c/Users/USERNAME/micromamba_prefix/envs/new_test_env/bin:/cygdrive/c/Users/USERNAME/micromamba_prefix/condabin:/usr/local/bin:/usr/bin:/cygdrive/c/Program Files (x86)/Common Files/Oracle/Java/javapath:/cygdrive/c/Apps/oracle/product/client/12.1.0.2/bin:/cygdrive/c/WINDOWS/system32:/cygdrive/c/WINDOWS:/cygdrive/c/WINDOWS/System32/Wbem:/cygdrive/c/WINDOWS/System32/WindowsPowerShell/v1.0:/cygdrive/c/WINDOWS/System32/OpenSSH:/cygdrive/c/Program Files (x86)/dotnet:/cygdrive/c/Program Files/Git/cmd:/cygdrive/c/Program Files/dotnet:/cygdrive/c/Program Files/Microsoft VS Code/bin:/cygdrive/c/Users/USERNAME/AppData/Local/Microsoft/WindowsApps:/cygdrive/c/Users/USERNAME/AppData/local/miniconda3/Scripts:/cygdrive/c/Users/USERNAME/AppData/local/miniconda3/etc/profile.d:/cygdrive/c/Users/USERNAME/AppData/Local/Programs/Microsoft VS Code/bin'\''
export CONDA_PREFIX='\''C:\cygdrive\c\Users\USERNAME\micromamba_prefix\envs\new_test_env'\''
export CONDA_SHLVL='\''2'\''
export CONDA_DEFAULT_ENV='\''new_test_env'\''
export CONDA_PROMPT_MODIFIER='\''(new_test_env) '\''
export CONDA_PREFIX_1='\''C:\cygdrive\c\Users\USERNAME\micromamba_prefix\envs\not_base'\'''
+ eval 'PS1='\''(new_test_env) \[\e[1;35m\]\u@\h
\[\e[0;35m\]\w\[\e[0;36m\]$(parse_git_branch)\[\e[0;35m\] $ \[\e[m\]\[\e]0;\u\w\a\]'\''
export PATH='\''/cygdrive/c/cygdrive/c/Users/USERNAME/micromamba_prefix/envs/new_test_env:/cygdrive/c/cygdrive/c/Users/USERNAME/micromamba_prefix/envs/new_test_env/Library/mingw-w64/bin:/cygdrive/c/cygdrive/c/Users/USERNAME/micromamba_prefix/envs/new_test_env/Library/usr/bin:/cygdrive/c/cygdrive/c/Users/USERNAME/micromamba_prefix/envs/new_test_env/Library/bin:/cygdrive/c/cygdrive/c/Users/USERNAME/micromamba_prefix/envs/new_test_env/Scripts:/cygdrive/c/cygdrive/c/Users/USERNAME/micromamba_prefix/envs/new_test_env/bin:/cygdrive/c/Users/USERNAME/micromamba_prefix/condabin:/usr/local/bin:/usr/bin:/cygdrive/c/Program Files (x86)/Common Files/Oracle/Java/javapath:/cygdrive/c/Apps/oracle/product/client/12.1.0.2/bin:/cygdrive/c/WINDOWS/system32:/cygdrive/c/WINDOWS:/cygdrive/c/WINDOWS/System32/Wbem:/cygdrive/c/WINDOWS/System32/WindowsPowerShell/v1.0:/cygdrive/c/WINDOWS/System32/OpenSSH:/cygdrive/c/Program Files (x86)/dotnet:/cygdrive/c/Program Files/Git/cmd:/cygdrive/c/Program Files/dotnet:/cygdrive/c/Program Files/Microsoft VS Code/bin:/cygdrive/c/Users/USERNAME/AppData/Local/Microsoft/WindowsApps:/cygdrive/c/Users/USERNAME/AppData/local/miniconda3/Scripts:/cygdrive/c/Users/USERNAME/AppData/local/miniconda3/etc/profile.d:/cygdrive/c/Users/USERNAME/AppData/Local/Programs/Microsoft VS Code/bin'\''
export CONDA_PREFIX='\''C:\cygdrive\c\Users\USERNAME\micromamba_prefix\envs\new_test_env'\''
export CONDA_SHLVL='\''2'\''
export CONDA_DEFAULT_ENV='\''new_test_env'\''
export CONDA_PROMPT_MODIFIER='\''(new_test_env) '\''
export CONDA_PREFIX_1='\''C:\cygdrive\c\Users\USERNAME\micromamba_prefix\envs\not_base'\'''
++ PS1='(new_test_env) \[\e[1;35m\]\u@\h
\[\e[0;35m\]\w\[\e[0;36m\]$(parse_git_branch)\[\e[0;35m\] $ \[\e[m\]\[\e]0;\u\w\a\]'
++ export 'PATH=/cygdrive/c/cygdrive/c/Users/USERNAME/micromamba_prefix/envs/new_test_env:/cygdrive/c/cygdrive/c/Users/USERNAME/micromamba_prefix/envs/new_test_env/Library/mingw-w64/bin:/cygdrive/c/cygdrive/c/Users/USERNAME/micromamba_prefix/envs/new_test_env/Library/usr/bin:/cygdrive/c/cygdrive/c/Users/USERNAME/micromamba_prefix/envs/new_test_env/Library/bin:/cygdrive/c/cygdrive/c/Users/USERNAME/micromamba_prefix/envs/new_test_env/Scripts:/cygdrive/c/cygdrive/c/Users/USERNAME/micromamba_prefix/envs/new_test_env/bin:/cygdrive/c/Users/USERNAME/micromamba_prefix/condabin:/usr/local/bin:/usr/bin:/cygdrive/c/Program Files (x86)/Common Files/Oracle/Java/javapath:/cygdrive/c/Apps/oracle/product/client/12.1.0.2/bin:/cygdrive/c/WINDOWS/system32:/cygdrive/c/WINDOWS:/cygdrive/c/WINDOWS/System32/Wbem:/cygdrive/c/WINDOWS/System32/WindowsPowerShell/v1.0:/cygdrive/c/WINDOWS/System32/OpenSSH:/cygdrive/c/Program Files (x86)/dotnet:/cygdrive/c/Program Files/Git/cmd:/cygdrive/c/Program Files/dotnet:/cygdrive/c/Program Files/Microsoft VS Code/bin:/cygdrive/c/Users/USERNAME/AppData/Local/Microsoft/WindowsApps:/cygdrive/c/Users/USERNAME/AppData/local/miniconda3/Scripts:/cygdrive/c/Users/USERNAME/AppData/local/miniconda3/etc/profile.d:/cygdrive/c/Users/USERNAME/AppData/Local/Programs/Microsoft VS Code/bin'
++ PATH='/cygdrive/c/cygdrive/c/Users/USERNAME/micromamba_prefix/envs/new_test_env:/cygdrive/c/cygdrive/c/Users/USERNAME/micromamba_prefix/envs/new_test_env/Library/mingw-w64/bin:/cygdrive/c/cygdrive/c/Users/USERNAME/micromamba_prefix/envs/new_test_env/Library/usr/bin:/cygdrive/c/cygdrive/c/Users/USERNAME/micromamba_prefix/envs/new_test_env/Library/bin:/cygdrive/c/cygdrive/c/Users/USERNAME/micromamba_prefix/envs/new_test_env/Scripts:/cygdrive/c/cygdrive/c/Users/USERNAME/micromamba_prefix/envs/new_test_env/bin:/cygdrive/c/Users/USERNAME/micromamba_prefix/condabin:/usr/local/bin:/usr/bin:/cygdrive/c/Program Files (x86)/Common Files/Oracle/Java/javapath:/cygdrive/c/Apps/oracle/product/client/12.1.0.2/bin:/cygdrive/c/WINDOWS/system32:/cygdrive/c/WINDOWS:/cygdrive/c/WINDOWS/System32/Wbem:/cygdrive/c/WINDOWS/System32/WindowsPowerShell/v1.0:/cygdrive/c/WINDOWS/System32/OpenSSH:/cygdrive/c/Program Files (x86)/dotnet:/cygdrive/c/Program Files/Git/cmd:/cygdrive/c/Program Files/dotnet:/cygdrive/c/Program Files/Microsoft VS Code/bin:/cygdrive/c/Users/USERNAME/AppData/Local/Microsoft/WindowsApps:/cygdrive/c/Users/USERNAME/AppData/local/miniconda3/Scripts:/cygdrive/c/Users/USERNAME/AppData/local/miniconda3/etc/profile.d:/cygdrive/c/Users/USERNAME/AppData/Local/Programs/Microsoft VS Code/bin'
++ export 'CONDA_PREFIX=C:\cygdrive\c\Users\USERNAME\micromamba_prefix\envs\new_test_env'
++ CONDA_PREFIX='C:\cygdrive\c\Users\USERNAME\micromamba_prefix\envs\new_test_env'
++ export CONDA_SHLVL=2
++ CONDA_SHLVL=2
++ export CONDA_DEFAULT_ENV=new_test_env
++ CONDA_DEFAULT_ENV=new_test_env
++ export 'CONDA_PROMPT_MODIFIER=(new_test_env) '
++ CONDA_PROMPT_MODIFIER='(new_test_env) '
++ export 'CONDA_PREFIX_1=C:\cygdrive\c\Users\USERNAME\micromamba_prefix\envs\not_base'
++ CONDA_PREFIX_1='C:\cygdrive\c\Users\USERNAME\micromamba_prefix\envs\not_base'
+ __mamba_hashr
+ '[' -n '' ']'
+ '[' -n '' ']'
+ hash -r
++ parse_git_branch
++ git branch
++ sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
(new_test_env) USERNAME@DEVICE_NAME

@AntoinePrv
Copy link
Member Author

I don't know much about cygwin , cygdrive, default windows drive...

export MAMBA_ROOT_PREFIX='/cygdrive/c/Users/USERNAME/micromamba_prefix'

Is this one expected? What input did you provide? Would /c/Users/USERNAME/micromamba_prefix or C:/Users/USERNAME/micromamba_prefix work here?

I think if we can this input cleaned, the rest would not diverge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Micromamba >v1.4.5 broken with cygwin
3 participants