Core Library0.xAPI reference

Choose documentation 3

latest

Current version

latest
English

Early release libtmux is released, and its APIs may still change between releases. This site's structure and URLs may change too.

MoreLess about this notice

exception libtmux

SocketPathTooLong

A tmux socket path is longer than a UNIX socket address can hold.

Base types LibTmuxException
Source and package
Qualified name
libtmux.exc.SocketPathTooLong
Module
libtmux.exc
Package
libtmux
Source
src/libtmux/exc.py
exception libtmux.exc.SocketPathTooLong

Description

sun_path in struct sockaddr_un is a fixed-size buffer, so a path over the platform's limit can never be connected to, whatever the filesystem allows. tmux says error 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 long TMUX_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 byte
limit: /tmp/ddd... Inherited from $TMUX_TMPDIR: shorten it, or pass a
socket_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 LibTmuxException hierarchy, so except LibTmuxException catches it:

>>> issubclass(exc.SocketPathTooLong, exc.LibTmuxException)
True

Members1 members

Inherited members1 member

Reached through libtmux.exc.LibTmuxException.

Esc
Search in

Type to search.

Reference previewOpen reference