Stop polluting PATH with Cygwin bin directory on Windows#1069
Merged
Stop polluting PATH with Cygwin bin directory on Windows#1069
Conversation
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
Merged
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
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 stepsBASH_ENV/set -o igncrconfiguration that was only needed when Cygwin's bash was in PATHCYGWIN_ROOT,CYGWIN_ROOT_BIN, andCYGWIN_BASH_ENVconstantsSince 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
opam installand OCaml compilation still work correctly on Windows runnersshell: bashsteps after setup-ocaml use MSYS2 bash (not Cygwin bash)C:\.opam\.cygwin\root\binafter the action completes