[Xcb] Question about a xcb_util.c commit

Josh Triplett josh at joshtriplett.org
Fri Jun 10 16:50:42 UTC 2016


On Fri, Jun 10, 2016 at 04:30:34PM +0200, David Coppa wrote:
> I have a question regarding this particular commit, "Fallback to
> TCP if no protocol is specified and the UNIX connection fails",
> that you can see at
> https://cgit.freedesktop.org/xcb/libxcb/commit/?id=7d235c62f0d5bd0df1236cc52141c10c5d272a18
> 
> Does anyone know the rationale behind it?

Compatibility with the historical behavior of Xlib.  See
https://lists.x.org/archives/xorg-devel/2010-April/007915.html .

DISPLAY=:0 (or any :N) without a protocol specified means to try a UNIX
socket and then TCP.

> It seems strange to me to try to connect via tcp if opening the
> unix socket fails (because the X server crashed, for example).
> 
> I'm asking because this piece of code does not interact very well
> with the way we're sandboxing some window managers (specifically
> i3) using pledge() on OpenBSD.
> 
> When pledged, i3 is not allowed to open AF_INET sockets, only AF_UNIX
> ones.

If your default configuration has the X server listening only on a unix
socket, I would suggest having your default configuration set
DISPLAY=unix/:0 rather than DISPLAY=:0.  Then, applications will *only*
connect via UNIX socket, and never fall back to TCP.

I've reported a bug on xinit/startx to have them do this by default:
https://bugs.freedesktop.org/show_bug.cgi?id=96483

- Josh Triplett


More information about the Xcb mailing list