carlos / platform Public

host: the apply's syscalls are linux-only; every other OS builds the stubs

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015QCUCpfxbCyEAVQ2m51dH5
Paul Campbell pushed by paul@keymail.dev 8c4030f21ca0a93607419f335a16505e39845f82 parent cd0d59a
4 files changed, +27 −20
  • internal/host/systemapply_other.go +20 −0
  • internal/host/systemapply_unix.go +6 −1
  • internal/host/systemapply_unix_test.go +1 −1
  • internal/host/systemapply_windows.go +0 −18

CI passed — run details

diff --git a/internal/host/systemapply_other.go b/internal/host/systemapply_other.go
new file mode 100644
index 000000000..a7bc9d494
--- /dev/null
+++ b/internal/host/systemapply_other.go
@@ -0,0 +1,20 @@
+//go:build !linux
+
+package host
+
+import "os"
+
+// The platform self-update is a root oneshot on a Linux box; the macOS and
+// Windows builds exist only so the carlos CLI compiles for workstation use,
+// and neither has the syscalls systemapply_unix.go needs — darwin's stdlib
+// syscall package has no Openat at all. Both primitives refuse rather than
+// pretend: an apply that cannot lock, or that cannot open a path without
+// following symlinks, must do nothing at all — and Run tells this refusal
+// apart from a lock another apply is holding, so an unsupported platform is
+// an error rather than a quiet no-op.
+
+func openBeneath(root string, parts ...string) (*os.File, error) {
+ return nil, errSystemUnsupported
+}
+
+func flockExclusiveNonblock(f *os.File) error { return errSystemUnsupported }
diff --git a/internal/host/systemapply_unix.go b/internal/host/systemapply_unix.go
index 15dfa714f..883104836 100644
--- a/internal/host/systemapply_unix.go
+++ b/internal/host/systemapply_unix.go
@@ -1,4 +1,4 @@
-//go:build !windows
+//go:build linux
package host
@@ -12,6 +12,11 @@ import (
// The apply's two kernel-level needs, on the platform it actually runs on:
// opening a path under a user-owned tree without following one symlink, and
// an advisory lock that fails rather than waits when another apply holds it.
+//
+// linux, not unix: syscall.Openat is not in the stdlib syscall package on
+// darwin, and internal/host is linked into the CLI that people run on Macs.
+// The apply is a root oneshot on a Linux box and nothing else, so every
+// other OS gets systemapply_other.go's refusals and merely has to build.
// openBeneath opens root/parts... one component at a time with
// O_DIRECTORY|O_NOFOLLOW for every directory and O_NOFOLLOW for the leaf,
diff --git a/internal/host/systemapply_unix_test.go b/internal/host/systemapply_unix_test.go
index 9895f89dc..0019cf089 100644
--- a/internal/host/systemapply_unix_test.go
+++ b/internal/host/systemapply_unix_test.go
@@ -1,4 +1,4 @@
-//go:build !windows
+//go:build linux
package host
diff --git a/internal/host/systemapply_windows.go b/internal/host/systemapply_windows.go
deleted file mode 100644
index 146756492..000000000
--- a/internal/host/systemapply_windows.go
+++ /dev/null
@@ -1,18 +0,0 @@
-//go:build windows
-
-package host
-
-import "os"
-
-// The platform self-update is a root oneshot on a Linux box; the Windows
-// build exists only so the carlos CLI compiles for workstation use. Both
-// primitives refuse rather than pretend: an apply that cannot lock, or that
-// cannot open a path without following symlinks, must do nothing at all —
-// and Run tells this refusal apart from a lock another apply is holding, so
-// an unsupported platform is an error rather than a quiet no-op.
-
-func openBeneath(root string, parts ...string) (*os.File, error) {
- return nil, errSystemUnsupported
-}
-
-func flockExclusiveNonblock(f *os.File) error { return errSystemUnsupported }