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

[Windows] Internal cygwin installation should not populate to the path #6181

Open
dmtrKovalenko opened this issue Aug 26, 2024 · 2 comments
Open

Comments

@dmtrKovalenko
Copy link

dmtrKovalenko commented Aug 26, 2024

When opam init is called with -cygwin-local-install flag it populates the PATH with a newly installed Cygwin bash instance which changes how the scripts are executed afterwards

this can easily break scripts that are executed after (especially because Cygwin has its own rules for linebreaks)

Here is an example of this github actions run which uses setup-ocaml and runnings scripts with shell: bash

Before opam init
image

After opam init
image

@dmtrKovalenko
Copy link
Author

^ this does sound pretty spammy

@dra27
Copy link
Member

dra27 commented Aug 27, 2024

It's not opam which is doing it, but setup-ocaml itself cf. ocaml/setup-ocaml:packages/setup-ocaml-installer.ts#L69:

if (PLATFORM === "windows") {
    await setupCygwin();
    if (!cygwinCacheHit) {
      await saveCygwinCache();
    }
    core.addPath(CYGWIN_ROOT_BIN);
  }

That's sensible behaviour for the GitHub action, though (it is a change from v2 to v3, as v2 used a shim for the opam command which quietly did that on each invocation).

In general, mixing MSYS2 and Cygwin in the same build is going to lead to pain at some point, even when it's mostly working! I'd suggest either adapting the rest of the build to use Cygwin or instead configuring opam to an MSYS2 installation (that would require patching setup-ocaml). Note that opam cannot use Git-for-Windows as an MSYS2 installation (indeed, the fact it's in PATH is already against Git-for-Windows own recommendations...) - however, there is a normal MSYS2 installation on GitHub Actions runners as well, so it doesn't require an install.

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

No branches or pull requests

4 participants
@dra27 @dmtrKovalenko and others