Skip to content

Build on Windows: move the uid and mode checks behind build tags - #6

Open
ucsandman wants to merge 1 commit into
lajosdeme:mainfrom
ucsandman:windows-build
Open

Build on Windows: move the uid and mode checks behind build tags#6
ucsandman wants to merge 1 commit into
lajosdeme:mainfrom
ucsandman:windows-build

Conversation

@ucsandman

Copy link
Copy Markdown

I wanted to run mole on my Windows box and go build ./... failed on two spots in internal/daemon that read *syscall.Stat_t.

What this does:

  • Moves the perm and uid checks from checkPrivateDir into privdir_unix.go, unchanged.
  • privdir_windows.go returns no-ops. Go's FileInfo mode bits on Windows are made up (every dir reads 0777), so the 0o077 check would refuse every path. The ACL on the per user dir is what actually protects it there.
  • InspectSocket stops flagging the socket mode as a problem on Windows for the same reason.

Checked:

  • go build on windows, linux and darwin
  • go test ./internal/daemon on linux, same result as before
  • mole serve --toolkit on Windows 11, mole-mcp connects over the unix socket and mole.search returns results

Not touched: the rest of the test suite still assumes unix perms and a 104 byte socket path, so a bunch of tests fail on Windows. Didn't want to bloat this one. Happy to do a follow up if you want Windows in CI. Will sign the CLA.

🤖 Generated with Claude Code

https://claude.ai/code/session_0159iCPkpUZaAAzoYd9A6g2z

checkPrivateDir and InspectSocket read *syscall.Stat_t, which does not exist
on Windows, so `go build ./...` failed there. The unix checks move unchanged
into privdir_unix.go; privdir_windows.go supplies no-ops, because Go's
FileInfo mode bits on Windows are synthesised (0777 for every directory) and
the 0o077 test would refuse every path. The ACL on the per-user directory is
the control there. InspectSocket also stops flagging the synthesised socket
mode as a problem on Windows.

Verified: go build on windows, linux and darwin; go test ./internal/daemon
on linux unchanged; mole serve --toolkit on Windows 11 with mole-mcp and a
live mole.search over the unix socket.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0159iCPkpUZaAAzoYd9A6g2z
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