Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix daemonded not starting on Mac #1459

Merged
merged 3 commits into from
Dec 13, 2024
Merged

Conversation

slipher
Copy link
Member

@slipher slipher commented Dec 11, 2024

Fix #1390.

Somehow bind() has the same filename length limit from the 1970s
and there is no alternative API that can use a longer name. Recent
MacOS versions generate a long random path for TMPDIR, which causes
a fatal error for daemonded -
DaemonEngine#1390 (the server uses
a slightly longer path than the client).
Because I want to use pthread_chdir.

Needs to be updated in the release script too.
The default profile now generates a ~50-character-long $TMPDIR by
default (I assume it must have been shorter before). The singleton
socket path we generate for daemonded ends up too long for the
`bind` or `connect` APIs. (The socket path for clients is slightly
shorter and just sneaks under the limit.) Work around this by using
the Mac-specific pthread_chdir_np API to thread-safely change the
CWD to the directory with the socket, accessing it with a relative
path, then resetting the current directory to what it was before.

Fixes DaemonEngine#1390.
@illwieckz
Copy link
Member

With the bump of MACOSX_DEPLOYMENT_TARGET I will test this with the dockerized release script.

@illwieckz
Copy link
Member

I confirm it builds in dockerized release script and that the produced binaries work and the bug is fixed. GG!

Copy link
Member

@illwieckz illwieckz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@slipher slipher merged commit b508727 into DaemonEngine:master Dec 13, 2024
10 checks passed
@slipher slipher deleted the socketpath branch December 13, 2024 21:16
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.

Can't run daemonded on macOS
2 participants