Skip to content

Switch to opam's --cygwin-internal-install to avoid cygwin.com 403 errors#1067

Merged
smorimoto merged 2 commits intomasterfrom
switch-to-cygwin-internal-install
Mar 20, 2026
Merged

Switch to opam's --cygwin-internal-install to avoid cygwin.com 403 errors#1067
smorimoto merged 2 commits intomasterfrom
switch-to-cygwin-internal-install

Conversation

@smorimoto
Copy link
Copy Markdown
Member

@smorimoto smorimoto commented Mar 20, 2026

Summary

  • Switch from manual Cygwin setup (scraping cygwin.com + downloading setup-x86_64.exe) to opam's built-in --cygwin-internal-install flag, which embeds the Cygwin installer in the opam binary
  • Remove the separate Cygwin cache layer — the Cygwin installation now lives under OPAM_ROOT/.cygwin/root and is automatically included in the opam cache
  • Remove cheerio, @actions/http-client, and @actions/io dependencies (only used for Cygwin setup)
  • Add regex no-match detection in fixFstab() to warn when the fstab format differs from expectations
  • Bump cache-prefix default from v1 to v3 to invalidate incompatible old caches

Closes #1038

Test plan

  • CI passes on windows-latest (covered by .github/workflows/workflow.yml)
  • opam init --cygwin-internal-install completes successfully
  • Cygwin binaries (make, gcc, etc.) are available on PATH after setup
  • Cache save and restore works correctly (single opam cache replaces opam + Cygwin caches)
  • OCaml compiler builds and tests succeed on Windows

…rors

opam 2.4.0+ embeds setup-x86_64.exe and can manage Cygwin internally,
eliminating the need to scrape cygwin.com for version information and
download the installer separately. This resolves frequent 403 errors
from Cygwin's DDoS protection blocking GitHub Actions cloud IPs (#1038).

Key changes:
- Replace --cygwin-local-install/--cygwin-location with
  --cygwin-internal-install and --cygwin-extra-packages in opam init
- Derive CYGWIN_ROOT from OPAM_ROOT (.opam/.cygwin/root) so the Cygwin
  installation is automatically included in the opam cache
- Remove separate Cygwin cache layer (composeCygwinCacheKeys,
  composeCygwinCachePaths, restoreCygwinCache, saveCygwinCache)
- Remove setupCygwin(), getCygwinVersion(), and their dependencies
  (cheerio, @actions/http-client, @actions/io)
- Move BASH_ENV/fixFstab/PATH configuration after setupOpam() since
  opam now installs Cygwin internally
- Add regex no-match detection in fixFstab() to warn when the fstab
  format differs from expectations
- Bump cache-prefix default from v1 to v3 to invalidate incompatible
  old caches
@smorimoto smorimoto added the enhancement New feature or request label Mar 20, 2026
opam's --cygwin-internal-install generates fstab with noacl,binary,posix=0
by default, making the fixFstab() patch unnecessary. This also removes
windows.ts entirely as it no longer contains any functions.
@smorimoto smorimoto merged commit 7c50bce into master Mar 20, 2026
18 checks passed
@smorimoto smorimoto deleted the switch-to-cygwin-internal-install branch March 20, 2026 11:12
@smorimoto smorimoto mentioned this pull request Mar 23, 2026
tahina-pro added a commit to tahina-pro/quackyducky that referenced this pull request Mar 24, 2026
ocaml/setup-ocaml#1067 switched to opam's --cygwin-internal-install,
moving Cygwin from C:\cygwin to C:\.opam\.cygwin\root. Update all
Windows workflow shell references accordingly.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
tahina-pro added a commit to project-everest/everparse that referenced this pull request Mar 24, 2026
a2line added a commit to a2line/geneweb that referenced this pull request Mar 30, 2026
conf-perl-ipc-system-simple.4 and conf-perl-string-shellquote.4
(ocaml/opam-repository#29613) add native Cygwin/MSYS2 support,
installing Perl modules via cpan automatically during opam
dependency resolution — no manual step needed anymore.

This removes the curl+cpanm and opam pin workaround introduced
after setup-ocaml v3.5.0 broke conf-perl resolution on Windows
by switching to --cygwin-internal-install (ocaml/setup-ocaml#1067).
a2line added a commit to a2line/geneweb that referenced this pull request Mar 30, 2026
conf-perl-ipc-system-simple.4 and conf-perl-string-shellquote.4
(ocaml/opam-repository#29613) add native Cygwin/MSYS2 support,
installing Perl modules via cpan automatically during opam
dependency resolution — no manual step needed anymore.

This removes the curl+cpanm and opam pin workaround introduced
after setup-ocaml v3.5.0 broke conf-perl resolution on Windows
by switching to --cygwin-internal-install (ocaml/setup-ocaml#1067).
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.

Cygwin version check and download 403s

1 participant