fix(daemon): clear error for over-length socket path - #75
Open
olddognewflex wants to merge 1 commit into
Open
Conversation
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.
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.
Closes #68.
Problem
When qid's resolved socket path exceeds the OS
sockaddr_un.sun_pathlimit (104 bytes on darwin, 108 on Linux),net.Listen("unix", …)fails with a barebind: invalid argument. qid exits immediately andqi daemon startreports only "did not become ready", with the real reason buried inqid.log— the failure looks like a permissions or path bug, not a length bug.Fix
daemon.Listennow length-checks the path beforenet.Listenand returns a clear error naming the limit and the remedy:The limit is platform-specific, so it lives behind a
socket_darwin.go/socket_other.gobuild-tag split (maxSocketPathLen= 103 usable on darwin, 107 elsewhere —sun_pathsize minus the NUL), matching the existingdataless_darwin.go/dataless_other.goprecedent.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
Listenrejects an over-length path with a message naming the limit and remedy, before any filesystem side effect.Full
go test ./...,go vet,go build ./...green.