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

Provide working bash action on cygwin #11438

Open
tobil4sk opened this issue Feb 3, 2025 · 1 comment
Open

Provide working bash action on cygwin #11438

tobil4sk opened this issue Feb 3, 2025 · 1 comment
Labels

Comments

@tobil4sk
Copy link

tobil4sk commented Feb 3, 2025

Currently, dune simply looks for bash in PATH and executes it. With native opam set up with cygwin on Windows, this can lead to problems as cygwin's bash tends to not be available in PATH, so another bash may end up being used (e.g. WSL's). Additionally, even if bash is available in PATH, it is missing cygwin's PATH entries to make it usable.

Desired Behavior

The desired behaviour would be to:

  • Prioritise opam's configured cygwin install when looking for bash (over existing PATH entries)
  • Run the cygwin bash with PATH set up correctly so that scripts can run properly (via --login option for bash)

Example

(rule
 (targets bash.txt)
 (action
  (bash "echo \"$(cygpath -w $0)\n$PATH\" > bash.txt")
 )
)

The expected output would be the path to bash that belongs to opam's cygwin install, and the PATH entries should include /usr/local/bin:/usr/bin:....

@nojb
Copy link
Collaborator

nojb commented Feb 4, 2025

Sorry for the orthogonal comment, but I'll repeat my opinion here that I think (bash) is basically a mistake (even if a useful escape hatch sometimes), as it makes it easy to write non-cross-platform Dune files. The fact that OPAM currently includes a Cygwin install behind the scenes is an implementation detail; OCaml itself (apart from its build system) has no dependency on Cygwin.

That said, given that it already exists, I'm not against improving it :)

@maiste maiste added the windows label Feb 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants