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

Incorrect message on windows for updating environment vars #6134

Open
JonasOberhauser opened this issue Jul 31, 2024 · 7 comments
Open

Incorrect message on windows for updating environment vars #6134

JonasOberhauser opened this issue Jul 31, 2024 · 7 comments

Comments

@JonasOberhauser
Copy link

On windows, I get a message to run eval $(opam env). E.g.:



<><> Error report <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
+- The following actions failed
| - build coq-core 8.19.2
+-
- No changes have been performed
# Run eval $(opam env) to update the current shell environment

If I do, my $PATH is totally messed up and opam is no longer in the path.

Instead, it seems I should be using the command provided in a blog post here:

https://opam.ocaml.org/blog/opam-2-2-0-windows/

On second inspection, It seems that this only happens in my mingw shell, in powershell I get the correct command.
But either way running eval $(opam env) in the mingw shell does not produce the correct results.

@rjbou rjbou added the AREA: UI label Aug 2, 2024
@rjbou
Copy link
Collaborator

rjbou commented Aug 2, 2024

Can you share the output of opam env in your mingw shell?

@dra27
Copy link
Member

dra27 commented Aug 5, 2024

Indeed, if you're running opam from within Cygwin/MSYS2, etc. (i.e. bash or some such) then the command suggested is correct and it is supposed to work!

@JonasOberhauser
Copy link
Author

JonasOberhauser commented Aug 7, 2024

Can you share the output of opam env in your mingw shell?

I can tell you how the output differs from what is there in a working environment: all the paths (including paths unrelated to ocaml) are prefixed with /cygdrive/c/... or /cygdrive/d/..., e.g.,

...:/cygdrive/d/Program Files/Git/usr/bin/core_perl

while my working PATH has it as
...:/usr/bin/core_perl

@kit-ty-kate
Copy link
Member

I can tell you how the output differs from what is there in a working environment: all the paths (including paths unrelated to ocaml) are prefixed with /cygdrive/c/... or /cygdrive/d/...

both should be equivalent in a cygwin context so i'm not sure why that would break things. Are you using MSYS2, an existing Cygwin installation or the recommended internal Cygwin installation?

...:/cygdrive/d/Program Files/Git/usr/bin/core_perl

while my working PATH has it as ...:/usr/bin/core_perl

This part is pretty surprising though, are you sure this is verbatim what's in your PATH?
If so, opam is introducing the Git for Windows path without a separator (it should at least be ...:/cygdrive/d/Program Files/Git:/usr/bin/core_perl)

@dra27
Copy link
Member

dra27 commented Aug 8, 2024

I’ve just noticed something similar to this running opam-with-an-internal-Cygwin installation running in a different Cygwin installation - looks like you’re running opam-with-an-internal-Cygwin-installation in Git for Windows Bash (or an MSYS2 installation) and seeing a bigger version of the same problem.

@dra27
Copy link
Member

dra27 commented Aug 8, 2024

(I also have an idea for a fix…)

@dra27 dra27 added the KIND: BUG label Aug 8, 2024
@kit-ty-kate kit-ty-kate added this to the 2.3.0~alpha milestone Aug 8, 2024
@JonasOberhauser
Copy link
Author

I can tell you how the output differs from what is there in a working environment: all the paths (including paths unrelated to ocaml) are prefixed with /cygdrive/c/... or /cygdrive/d/...

both should be equivalent in a cygwin context so i'm not sure why that would break things. Are you using MSYS2, an existing Cygwin installation or the recommended internal Cygwin installation?

I am using my git for windows bash.

...:/cygdrive/d/Program Files/Git/usr/bin/core_perl
while my working PATH has it as ...:/usr/bin/core_perl

This part is pretty surprising though, are you sure this is verbatim what's in your PATH? If so, opam is introducing the Git for Windows path without a separator (it should at least be ...:/cygdrive/d/Program Files/Git:/usr/bin/core_perl)

Yep
image

@dra27 dra27 modified the milestones: 2.3.0~alpha1, 2.4.0~alpha1 Sep 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants