mirror of
https://github.com/zap-proto/zip.git
synced 2026-10-19 15:38:57 +00:00
sun_path is a fixed field holding a terminated string, so a unix address has 103 usable bytes on Darwin and 107 on Linux. Over that the kernel refuses the bind with EINVAL, which surfaces as "invalid argument" and names neither the length nor the path — the plugin child exits 1 and the host reports "exited before listening", which reads like a timing bug and is not. The limit now lives in internal/sock beside the path shape, since both are properties of the same address: minting one is not enough, it also has to be bindable. start() checks the longest address in play — the child's .sock.http upgrade listener — and refuses to launch rather than watching it die. 103 is measured, not read off a header: on Darwin a 103-byte path binds and a 104-byte one does not. The first cut of this used 104 and let through a path that was exactly one byte too long. The private instance directory also stops repeating the plugin's name. The binary and the socket inside it are already named for the plugin, so the copy in the directory spent len(name)+1 of a 103-byte budget saying it twice, and that was what pushed a long name over. Four idle tests and the status test built their Plugin.Dir from t.TempDir, which spends 89 bytes on the test's own name; sockDir has existed for exactly this reason. shortDir was a third copy of sockDir in the same test package, written from a comment that blamed sockDir for t.TempDir's length. Co-authored-by: Hanzo Dev <[email protected]>