Skip to content

fix: core/integration test binary compiles on macOS#11818

Draft
shykes wants to merge 6 commits intodagger:mainfrom
shykes:fix/macos-integration-compile
Draft

fix: core/integration test binary compiles on macOS#11818
shykes wants to merge 6 commits intodagger:mainfrom
shykes:fix/macos-integration-compile

Conversation

@shykes
Copy link
Contributor

@shykes shykes commented Feb 7, 2026

cd core/integration && go test -c fails on macOS because several files in core/ use Linux-only symbols (syscall.Mount, unix.Unshare, unix.OpenTree, overlay.GetOverlayLayers, etc.) without build tags. This PR extracts those symbols into platform-specific _linux.go files with darwin/windows stubs, completing the work started in #11817.

Summary

  • Export CopyFileContent on darwin in internal/fsutil/copy to match the linux API
  • Extract syscall.Mount/syscall.Unmount bind-mount calls from core/changeset.go into platform-specific helpers
  • Move 4 Linux-only functions from core/git_remote.go (runWithStandardUmaskAndNetOverride, unshareAndRun, overrideNetworkConfig, runProcessGroup) into git_remote_linux.go
  • Move mountIntoContainer from core/service.go into service_linux.go
  • Move pathResolverForMount from core/util.go into util_mount_linux.go (overlay case is Linux-only)
  • All non-Linux platforms get stubs that panic or return errors (these code paths only execute inside the engine on Linux)

Test plan

  • go build ./internal/fsutil/copy/ succeeds on macOS
  • go build ./core/ succeeds on macOS
  • go build ./engine/buildkit/ succeeds on macOS
  • cd core/integration && go test -c succeeds on macOS

Move the runContainer method from executor_spec.go into
executor_run.go (linux-only) and executor_run_unimplemented.go
(darwin/windows stub), following the existing pattern used by
linux_namespace.go / unimplemented_namespace.go. This removes
Linux-only golang.org/x/sys/unix symbols from the unconditional
build, fixing `go build ./engine/buildkit/` on macOS.
The Linux copy_linux.go exports CopyFileContent (uppercase) but the
Darwin file only had copyFileContent (lowercase), causing compilation
failures when other packages reference the exported symbol.

Signed-off-by: Solomon Hykes <[email protected]>
The syscall.Mount/Unmount calls with MS_BIND and MNT_DETACH are
Linux-only. Extract them into bindMountDir/unmountDir helpers in
platform-specific files so changeset.go compiles on darwin.

Signed-off-by: Solomon Hykes <[email protected]>
Move runWithStandardUmaskAndNetOverride, unshareAndRun,
overrideNetworkConfig, and runProcessGroup into git_remote_linux.go.
These use unix.Unshare, unix.Setns, moby/sys/mount, and
unix.SysProcAttr which are unavailable on darwin.

Signed-off-by: Solomon Hykes <[email protected]>
…S build

mountIntoContainer uses unix.OpenTree, unix.MoveMount, and
unix.MNT_DETACH which are Linux-only. Move it to service_linux.go
with a stub on darwin/windows.

Signed-off-by: Solomon Hykes <[email protected]>
…cOS build

pathResolverForMount references overlay.GetOverlayLayers which is
only available on Linux. Move the function to util_mount_linux.go
(with overlay support) and util_mount_unimplemented.go (bind-only).

Signed-off-by: Solomon Hykes <[email protected]>
@shykes shykes force-pushed the fix/macos-integration-compile branch from 9eff467 to 13afbc7 Compare February 7, 2026 10:05
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