ocaml / opam

opam is a source-based package manager. It supports multiple simultaneous compiler installations, flexible package constraints, and a Git-friendly development workflow.
https://opam.ocaml.org
Other
1.21k stars 348 forks source link

Windows/Cygwin: opam break the fish environement path #6053

Open Chimrod opened 1 week ago

Chimrod commented 1 week ago

I’m using opam on windows, with the fish environement.

After the environment intialisation, my terminal broke, not reconignizing any basic commands like ls. After digging a bit, It look likes the path where replaced with a mix of unix and windows path.

$ echo $PATH
/usr/local/bin /bin /cygdrive/c/Program Files (x86)/Common Files/Oracle/Java/java8path /cygdrive/c/Program Files (x86)/Common Files/Oracle/Java/javapath /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/PuTTY /cygdrive/c/Program Files/Azure Data Studio/bin /cygdrive/c/Program Files/dotnet /cygdrive/c/Program Files (x86)/GnuPG/bin /cygdrive/c/Program Files (x86)/Microsoft SQL Server/160/DTS/Binn /cygdrive/c/Program Files/PowerShell/7 /cygdrive/c/Program Files/Python39 /cygdrive/c/Users/sdai/AppData/Local/Microsoft/WindowsApps /usr/bin /cygdrive/c/Program Files/Azure Data Studio/bin /cygdrive/c/Users/sdai/AppData/Local/Pandoc /cygdrive/c/Program Files/Neovim/bin /cygdrive/c/Users/sdai/AppData/Local/Programs/GnuPG/bin

Path variable after sourcing

$ source '/cygdrive/d/home/.opam/opam-init/env_hook.fish'
$ echo $PATH
D \home\.opam\basev0.16\bin;D \bin\cygwin\usr\local\bin;D \bin\cygwin\bin;C \Program Files (x86)\Common Files\Oracle\Java\java8path;C \Program Files (x86)\Common Files\Oracle\Java\javapath;C \Windows\System32;C \Windows;C \Windows\System32\wbem;C \Windows\System32\WindowsPowerShell\v1.0;C \Windows\System32\OpenSSH;C \Program Files\PuTTY;C \Program Files\Azure Data Studio\bin;C \Program Files\dotnet;C \Program Files (x86)\GnuPG\bin;C \Program Files (x86)\Microsoft SQL Server\160\DTS\Binn;C \Program Files\PowerShell\7;C \Program Files\Python39;C \Users\sdai\AppData\Local\Microsoft\WindowsApps;D \bin\cygwin\bin;C \Program Files\Azure Data Studio\bin;C \Users\sdai\AppData\Local\Pandoc;C \Program Files\Neovim\bin;C \Users\sdai\AppData\Local\Programs\GnuPG\bin
fish: Unknown command: opam
~/.opam/opam-init/env_hook.fish (line 1):
opam env --shell=fish --readonly 2> /dev/null
^~~^
in command substitution
        called on line 3 of file ~/.opam/opam-init/env_hook.fish
in function '__opam_env_export_eval'
in event handler: handler for generic event 'fish_prompt'
~/.opam/opam-init/env_hook.fish (line 3): Unknown command
    eval (opam env --shell=fish --readonly 2> /dev/null)
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
in function '__opam_env_export_eval'
in event handler: handler for generic event 'fish_prompt'
dra27 commented 1 week ago

Can I double-check which version of opam you're using? Also, what's the output - before sourcing env_hook.fish of opam env itself?