SocketPathTooLong
A tmux socket path is longer than a UNIX socket address can hold.
Source and package
- Qualified name
-
libtmux.exc. Socket Path Too Long - Module
- libtmux.exc
- Package
- libtmux
- Source
- src/libtmux/exc.py
-
Description
sun_pathinstruct sockaddr_unis a fixed-size buffer, so a path over the platform's limit can never be connected to, whatever the filesystem allows. tmux sayserror connecting to <path> (File name too long), which names the path but not how far over it is, nor which variable made it that long.The overrun is usually inherited rather than typed: a deep pytest
tmp_path, an XDG runtime dir, a nested worktree, a longTMUX_TMPDIR. So the message adds the numbers tmux leaves out -- how many bytes over the limit, and where the length came from.Examples
>>> from libtmux import exc>>> print(exc.SocketPathTooLong("/tmp/" + "d" * 120 + "/sock", 107))Socket path is 130 bytes, 23 over the 107 byte limit: /tmp/ddd...A path nobody typed says where it came from, and what to shorten:
>>> print(... exc.SocketPathTooLong(... "/tmp/" + "d" * 120 + "/tmux-1000/dev",... 107,... socket_name="dev",... env_var="TMUX_TMPDIR",... env_value="/tmp/" + "d" * 120,... )... )Socket path for socket_name='dev' is 139 bytes, 32 over the 107 bytelimit: /tmp/ddd... Inherited from $TMUX_TMPDIR: shorten it, or pass asocket_path under a shorter directory.The numbers and the provenance are readable, for a caller that would rather format its own message:
>>> e = exc.SocketPathTooLong("/tmp/" + "d" * 120 + "/sock", 107)>>> e.length, e.over, e.limit, e.env_var(130, 23, 107, None)It is part of the
LibTmuxExceptionhierarchy, soexcept LibTmuxExceptioncatches it:>>> issubclass(exc.SocketPathTooLong, exc.LibTmuxException)True
Inherited members1 member
Reached through libtmux.exc.LibTmuxException.