Skip to content

Stop polluting PATH with Cygwin bin directory on Windows#1069

Merged
smorimoto merged 1 commit intomasterfrom
stop-polluting-path-with-cygwin
Mar 20, 2026
Merged

Stop polluting PATH with Cygwin bin directory on Windows#1069
smorimoto merged 1 commit intomasterfrom
stop-polluting-path-with-cygwin

Conversation

@smorimoto
Copy link
Copy Markdown
Member

@smorimoto smorimoto commented Mar 20, 2026

Summary

  • Remove core.addPath(CYGWIN_ROOT_BIN) which was prepending the Cygwin bin directory to PATH on Windows, causing Cygwin's bash to shadow the default MSYS2 bash in subsequent workflow steps
  • Remove the BASH_ENV / set -o igncr configuration that was only needed when Cygwin's bash was in PATH
  • Remove the now-unused CYGWIN_ROOT, CYGWIN_ROOT_BIN, and CYGWIN_BASH_ENV constants

Since the recent switch to --cygwin-internal-install, opam manages its own Cygwin environment internally, so there is no longer any need to expose Cygwin on the global PATH.

Closes #1008

Test plan

  • Verify that opam install and OCaml compilation still work correctly on Windows runners
  • Verify that shell: bash steps after setup-ocaml use MSYS2 bash (not Cygwin bash)
  • Verify that PATH no longer contains C:\.opam\.cygwin\root\bin after the action completes

Now that opam manages Cygwin internally via --cygwin-internal-install,
there is no need to add CYGWIN_ROOT_BIN to the global PATH or to
configure BASH_ENV with igncr. Removing these avoids shadowing the
default MSYS2 bash with Cygwin's bash, which could break subsequent
workflow steps that use `shell: bash`.

Closes #1008
@smorimoto smorimoto added the enhancement New feature or request label Mar 20, 2026
@smorimoto smorimoto merged commit 330b4e9 into master Mar 20, 2026
18 checks passed
@smorimoto smorimoto deleted the stop-polluting-path-with-cygwin branch March 20, 2026 11:12
@smorimoto smorimoto mentioned this pull request Mar 23, 2026
smorimoto added a commit that referenced this pull request Mar 23, 2026
PR #1069 removed core.addPath(CYGWIN_ROOT_BIN) to stop Cygwin's bash
from shadowing MSYS2 bash, but this also removed all Cygwin utilities
from PATH, breaking downstream projects that depend on them.

Instead of prepending with core.addPath() (which always prepends), use
core.exportVariable("PATH", ...) to append Cygwin bin to the end of
PATH. This keeps MSYS2 bash as the default shell whilst ensuring Cygwin
utilities remain accessible.

Closes #1084
smorimoto added a commit that referenced this pull request Mar 23, 2026
PR #1069 removed core.addPath(CYGWIN_ROOT_BIN) to stop Cygwin's bash
from shadowing MSYS2 bash, but this also removed all Cygwin utilities
from PATH, breaking downstream projects that depend on them.

Instead of prepending with core.addPath() (which always prepends), use
core.exportVariable("PATH", ...) to append Cygwin bin to the end of
PATH. This keeps MSYS2 bash as the default shell whilst ensuring Cygwin
utilities remain accessible.

The BASH_ENV / igncr configuration is also removed as MSYS2 bash
handles line endings on its own.

Closes #1084
smorimoto added a commit that referenced this pull request Mar 23, 2026
PR #1069 removed core.addPath(CYGWIN_ROOT_BIN) unconditionally to fix
#1008 (Cygwin bash shadowing MSYS2 bash), but this also broke downstream
projects that depend on Cygwin utilities and Cygwin bash for /cygdrive/
path resolution.

The original code lacked a WINDOWS_ENVIRONMENT guard, so even msys2
users were affected. The real fix is to restore the original behaviour
but only when windows-environment is set to cygwin.

Closes #1084
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

1 participant