Skip to content

fix(daemon): clear error for over-length socket path - #75

Open
olddognewflex wants to merge 1 commit into
mainfrom
fix/socket-path-limit
Open

fix(daemon): clear error for over-length socket path#75
olddognewflex wants to merge 1 commit into
mainfrom
fix/socket-path-limit

Conversation

@olddognewflex

Copy link
Copy Markdown
Owner

Closes #68.

Problem

When qid's resolved socket path exceeds the OS sockaddr_un.sun_path limit (104 bytes on darwin, 108 on Linux), net.Listen("unix", …) fails with a bare bind: invalid argument. qid exits immediately and qi daemon start reports only "did not become ready", with the real reason buried in qid.log — the failure looks like a permissions or path bug, not a length bug.

Fix

daemon.Listen now length-checks the path before net.Listen and returns a clear error naming the limit and the remedy:

socket path is N bytes, over the M-byte OS limit for unix sockets on this platform; use a shorter --socket or XDG_RUNTIME_DIR

The limit is platform-specific, so it lives behind a socket_darwin.go / socket_other.go build-tag split (maxSocketPathLen = 103 usable on darwin, 107 elsewhere — sun_path size minus the NUL), matching the existing dataless_darwin.go / dataless_other.go precedent.

Purely additive: a clearer error in front of an already-fatal condition. Per the issue, actually working around the limit (chdir + relative name, hashing) is out of scope.

Tests

  • Listen rejects an over-length path with a message naming the limit and remedy, before any filesystem side effect.
  • A normal short path still binds (regression guard).

Full go test ./..., go vet, go build ./... green.

net.Listen("unix", path) fails with a bare "bind: invalid argument"
when the path exceeds sockaddr_un.sun_path, which reads like a
permissions or path-existence bug (closes #68). qid then exits and
`qi daemon start` reports only "did not become ready".

Listen now length-checks the path before net.Listen and returns a
clear over-limit error naming the platform limit and the fix (shorter
--socket / XDG_RUNTIME_DIR). The limit is platform-specific
(sockaddr_un.sun_path: 103 usable on darwin, 107 elsewhere) via a
socket_darwin.go / socket_other.go build-tag split, matching the
existing dataless_darwin.go / _other.go precedent. Purely additive —
a clearer error in front of an already-fatal condition.
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.

qid: socket path over macOS sun_path limit fails with cryptic 'bind: invalid argument'

1 participant