Skip to content

Resolve ghcup isolation installation failure in Haskell autotester#725

Open
donny-wong wants to merge 2 commits into
MarkUsProject:masterfrom
donny-wong:fix_stack_install_isolate_flag
Open

Resolve ghcup isolation installation failure in Haskell autotester#725
donny-wong wants to merge 2 commits into
MarkUsProject:masterfrom
donny-wong:fix_stack_install_isolate_flag

Conversation

@donny-wong
Copy link
Copy Markdown
Contributor

@donny-wong donny-wong commented May 26, 2026

Context

During the Docker container build and initialization phase, the Haskell toolchain installer (ghcup) was failing when executing /app/autotest_server/testers/haskell/requirements.system. This failure returned a non-zero exit code (100).

Cause of the Issue

The script previously passed the --isolate /usr/local/bin flag to ghcup. However, ghcup includes a strict safety guard: it will refuse to unpack assets into an isolation target directory if that directory is not completely empty. Because modern base images (like ubuntu:24.04) pre-populate /usr/local/bin with standard system binaries and symlinks, ghcup aborted with a fatal error:
[ Error ] Install directory /usr/local/bin is not empty.

Changes Implemented

  1. Isolated Sandboxing: Updated requirements.system to create a dedicated, guaranteed-empty subdirectory: /usr/local/bin/stack-isolated.
  2. Global Symlinking: Directed ghcup to extract stack cleanly into this empty directory, then created a system-wide symlink at /usr/local/bin/stack pointing to the isolated binary (/usr/local/bin/stack-isolated/stack). This satisfies ghcup's safety checks while keeping the binary universally accessible to the tester framework.
  3. Robust Home Expansion: Swapped out the $HOME environment variable for shell tilde (~) expansion to ensure absolute home path resolution regardless of the active Docker build context.

@donny-wong donny-wong requested a review from david-yz-liu May 26, 2026 03:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant