ocaml / setup-ocaml

GitHub Action for the OCaml programming language
https://ocaml.org/
MIT License
197 stars 38 forks source link

v3 regression over v2: `opam exec` now fails with "Exec format error" on shell scripts on Windows #866

Open JasonGross opened 3 weeks ago

JasonGross commented 3 weeks ago
opam exec -- ./test.sh
Fatal error: exception C:\hostedtoolcache\windows\opam\2.2.1\x86_64\opam.exe: "create_process" failed on ./test.sh: Exec format error

https://github.com/JasonGross/test/actions/runs/10953316111/job/30413386004

logs_28625164728.zip

Full yml file ```yaml name: Example Workflow on: [push, pull_request] jobs: build: runs-on: windows-latest name: build steps: - uses: actions/checkout@v4 with: submodules: recursive - uses: ocaml/setup-ocaml@v3 with: ocaml-compiler: 4.13.1 - run: opam exec -- chmod +x test.sh - run: opam exec -- cat test.sh - run: opam exec -- ./test.sh buildv2: runs-on: windows-latest name: buildv2 steps: - uses: actions/checkout@v2 with: submodules: recursive - uses: ocaml/setup-ocaml@v2 with: ocaml-compiler: 4.13.1 - run: opam exec -- chmod +x test.sh - run: opam exec -- cat test.sh - run: opam exec -- ./test.sh ```
smorimoto commented 1 week ago

Is it related to this? https://github.com/ocaml/setup-ocaml/issues/815

JasonGross commented 1 week ago

You are suggesting that it might be related to https://github.com/ocaml/setup-ocaml/issues/815#issuecomment-2204843777 in particular, where perhaps indirecting through ocaml-env exec -- opam.exe exec instead of jumping straight to opam exec might change something? Or that opam exec might sometimes recognize bash scripts depending on what shell its run from? (The problem is that opam is trying to run the bash script as a binary executable, but I don't know what's causing that issue.) Is there a way to disentangle opam version issues from setup-ocaml version issues by changing something at https://github.com/JasonGross/test/blob/d70236be3e6d76e9bcac5a65b68298784b33f44d/.github/workflows/main.yml ?