Fix macOS build and tcp:// socket connect/bind (EINVAL) - #4
Open
ale-rinaldi wants to merge 2 commits into
Open
Conversation
CMake 4.x removed compatibility with cmake_minimum_required < 3.5, so configuration aborted before any source was compiled. Use the 3.5...3.28 range syntax so the project configures on modern CMake across macOS and Linux while keeping the old policy behaviour. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
call_connect() and gck_rpc_layer_initialize() declare the address as a
struct sockaddr_un but reuse that oversized buffer for AF_INET (tcp://)
addresses, then pass sizeof(sockaddr_un) as the socklen. Linux ignores
the extra length, but macOS/BSD validate it against the address family
and reject AF_INET with EINVAL ("Invalid argument"), so tcp:// sockets
fail at connect() (client) and bind() (daemon).
Track the correct length per branch (sizeof sockaddr_in for tcp://,
sizeof sockaddr_un for the Unix path) and pass that to connect()/bind().
Unix-socket behaviour on Linux is unchanged.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two small, cross-platform fixes that let the project build and run on macOS while keeping Linux behaviour unchanged.
1. CMake 4.x compatibility
cmake_minimum_required (VERSION 2.4)aborts configuration on CMake 4.x(
Compatibility with CMake < 3.5 has been removed), before any source iscompiled. Bumped to the
3.5...3.28range so it configures on modernCMake across macOS and Linux while preserving the existing policy behaviour.
2. tcp:// sockets fail with EINVAL on macOS/BSD
call_connect()(client) andgck_rpc_layer_initialize()(daemon) declarethe address as a
struct sockaddr_unbut reuse that oversized buffer forAF_INET(tcp://) addresses, then passsizeof(sockaddr_un)as thesocklen. Linux ignores the extra length; macOS/BSD validate it against the
address family and reject
AF_INETwithEINVAL("Invalid argument"), sotcp://sockets fail atconnect()andbind():Fixed by tracking the address-family-correct length per branch
(
sizeof(sockaddr_in)fortcp://,sizeof(sockaddr_un)for the Unixpath) and passing it to
connect()/bind(). Unix-socket behaviour onLinux is unchanged.
Verified:
tcp://connect and the daemontcp://bind now succeed onmacOS; the Unix-socket path is untouched.
🤖 Generated with Claude Code