[Windows] Internal cygwin installation should not populate to the path
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
After opam init
^ this does sound pretty spammy
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.