Skip to content

Drop macOS sandbox Unix socket workaround - #982

Merged
moonfruit merged 1 commit into
mainfrom
drop-macos-sandbox-socket-workaround
Sep 20, 2026
Merged

moonfruit merged 1 commit into
mainfrom
drop-macos-sandbox-socket-workaround

Conversation

@moonfruit

Copy link
Copy Markdown
Owner

tests.yml had a macOS-only step that inserted an extra
(allow network* network-outbound (subpath "/private/tmp")) rule into
brew's seatbelt profile before brew test-bot --only-formulae.

It worked around Homebrew/brew#23934: brew's sandbox only allows
Unix-domain sockets under each build's private TMPDIR, while MSBuild
hard-coded its task host pipes to /tmp/MSBuild<pid>, so every
dotnet publish with PublishTrimmed=true (officecli-bundled,
seqcli, marksman-bundled) died with MSB4216.

homebrew-core has since patched MSBuild's NamedPipeUtil in both
dotnet (10.0.401) and dotnet@9 (9.0.121) to use TMPDIR when it is
short enough, and both have rebuilt bottles for arm64_tahoe and
arm64_golden_gate. The sandbox's own TMPDIR is
/private/tmp/s-XXXXXXXX, which is both short enough for that check and
already covered by brew's allow_network path: tmpdir, type: :subpath
rule, so the workaround is no longer needed.

Verified with a local source build of officecli-bundled on brew
14c54f7c76, whose sandbox still denies Unix sockets, with no
modification to sandbox.rb: the build succeeded with no MSB4216, all
.NET sockets stayed inside /private/tmp/s-VhGQvFkq/, and trimming still
applied (33.7 MB).

marksman-bundled was not rebuilt locally, but its dotnet@9 carries
the same patch in a bottle built after it.

- `dotnet` and `dotnet@9` now patch MSBuild's `NamedPipeUtil` to
  honour `TMPDIR`, so its task host pipes land in the sandbox's
  own temporary directory, which brew already allows
- verified with a local source build of `officecli-bundled` on
  brew `14c54f7c76` with the sandbox untouched: no `MSB4216`
@moonfruit
moonfruit merged commit 9eb4bb5 into main Sep 20, 2026
4 checks passed
@moonfruit
moonfruit deleted the drop-macos-sandbox-socket-workaround branch September 20, 2026 02:08
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