Skip to content

Commit 372d35b

Browse files
authored
Fix Homebrew container install user (#467)
## Summary Run the Homebrew setup commands in the `homebrew/brew` container as the `linuxbrew` user instead of root, while discovering the `brew` executable from the container PATH at runtime. The container job still runs as root so GitHub Actions checkout/tooling can write to the mounted workspace, but recent `homebrew/brew` images have been brittle when `brew install` itself runs as root. PR #466 is currently failing before Rust setup/tests with Homebrew crashing while pouring the `ca-certificates` bottle: ```text undefined method '[]' for nil /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/utils/bottles.rb:127:in 'Utils::Bottles.load_tab' ``` This PR keeps the existing container shape but switches the install step to: ```bash brew_bin="$(command -v brew)" su linuxbrew -c "${brew_bin} update || true" su linuxbrew -c "${brew_bin} install python@3.12 python@3.11" ``` That avoids hardcoding the Linuxbrew prefix while still avoiding root-owned Homebrew install behavior. ## Validation This is a CI-only workaround. The useful validation is the `ci-homebrew-container` Actions job on this PR.
1 parent 2ff10b0 commit 372d35b

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

.github/workflows/pr-check.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -414,10 +414,12 @@ jobs:
414414
- name: Homebrew Python
415415
if: startsWith( matrix.image, 'homebrew')
416416
run: |
417-
# homebrew/brew:4.4.6 broke running `brew install` as root.
418-
# As a workaround, running `brew update` and ignoring errors coming from it fixes `brew install`.
419-
brew update || true
420-
brew install python@3.12 python@3.11
417+
# The job container runs as root so Actions checkout/tooling can write to the
418+
# mounted workspace, but Homebrew's prefix is owned by linuxbrew and recent
419+
# homebrew/brew images have been brittle when `brew install` runs as root.
420+
brew_bin="$(command -v brew)"
421+
su linuxbrew -c "${brew_bin} update || true"
422+
su linuxbrew -c "${brew_bin} install python@3.12 python@3.11"
421423
shell: bash
422424

423425
# Rust

0 commit comments

Comments
 (0)