From 5f6e45e1d4b2cd6b90373eb189da6dd8581da6f2 Mon Sep 17 00:00:00 2001 From: goodboy Date: Thu, 26 Mar 2026 21:56:33 -0400 Subject: [PATCH] Fix `mk_maddr()` crash on absolute UDS paths Strip leading `/` from `filepath` before building the `/unix/{path}` multiaddr string; OW absolute sockpaths like `/run/user/1000/tractor/foo.sock` produce `/unix//run/..` which `py-multiaddr` rejects as "empty protocol path". Woops, missed this in the initial `mk_maddr()` impl bc the unit tests only used relative `filedir` values (which was even noted in a comment..). The bug only surfaces when the `.maddr` property on `UDSTransport` is hit during logging/repr with real runtime addrs. Found-via: cross-suite `pytest tests/ipc/ tests/msg/` where `tpt_proto='uds'` leaks into msg tests (this patch was generated in some part by [`claude-code`][claude-code-gh]) [claude-code-gh]: https://github.com/anthropics/claude-code --- tractor/discovery/_multiaddr.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tractor/discovery/_multiaddr.py b/tractor/discovery/_multiaddr.py index 2a0ee7e6..d9046e03 100644 --- a/tractor/discovery/_multiaddr.py +++ b/tractor/discovery/_multiaddr.py @@ -78,8 +78,13 @@ def mk_maddr( case 'uds': filedir, filename = addr.unwrap() filepath = Path(filedir) / filename + # NOTE, strip any leading `/` to avoid + # double-slash `/unix//run/..` which the + # multiaddr parser rejects as "empty + # protocol path". + fpath_str: str = str(filepath).lstrip('/') return Multiaddr( - f'/{maddr_proto}/{filepath}' + f'/{maddr_proto}/{fpath_str}' )