Follow up from #888.
Add a --bind=
option, similar to the --bind-tcp
option but for unix domain sockets, and eventually named pipes for win32(#389). This would ease the transition to /run
: we can just create sockets in both locations by default.
It may also help with containers if we support both a directory form (--bind=dir:$HOME/.xpra
) and an absolute path (--bind=socket:/path/to/thesocket
.
And maybe this could help with selinux (#815) because we can then pick the socket in its more "proper" location.
r11485 implements this for unix domain sockets. r11486 adds $UID
and $GID
path extension (as used for socket-dirs
already).
Example:
xpra start \ --bind=/tmp/ --bind=/run/user/$UID/xpra/ --bind=/home/antoine/tmp/tmp/mysocket
Will create:
/tmp
and /run/user/$UID/xpra/
/home/antoine/tmp/tmp/mysocket
I could have used a more explicit differentiator between socket directories (identified by a trailing slash or if the directory exists already) and explicit filenames ("mysocket"), but I couldn't come up with anything that wasn't ugly.
Note: the sockets created will only be found by clients if they are in one of the directories specified with the socket-dirs
option. For backwards compatibility with older clients / servers, you should keep ~/.xpra/
in that list.
Sockets specified using the full filename will not be found, even if they are in a socket-dir that is searched by clients, unless the actual socket filename matches the hostname. (like the automatically generated ones)
@jonathan.underwood: if all your other clients and servers are 0.17 or later, you can now safely change the default socket location to be /var/run/user/$UID/xpra
and things should just work.
See also #1066.
Fix for "upgrade" server exit in r11722, ideally we should keep track of which server owns which sockets to make we cleanup all the ones that we should cleanup.
attempt at figuring out the real socket path from the socket file descriptor - does not work..
Can confirm that on 0.16.2, starting server like this:
xpra start --start-child=xterm --socket-dir=/run/user/1000/xpra :100
and then simply doing a
xpra --mmap=no attach ssh:withnail.phys.ucl.ac.uk:100
worked fine. Does that cover what you wanted?
Also, I'm not quite clear quite what the --bind is intended to do - in your example (with three paths), is it creating three sockets at the three paths? You talk about 2 sockets, so I am a bit confused.
Aside: I looked for it in the man page (on 0.16.2), and didn't see any mention there.
jonathan.underwood: no, socket-dir
and bind
are related, but different things. bind
is a 0.17 feature (sorry about the confusion) which allows you to create as many unix domain sockets as you like.
I have edited comment:1 to try to clarify.
@jonathan.underwood: we have a problem, please see ticket:1129#comment:9
@afarr: I think we can close this ticket for 0.17 as this works fine (unless you can break it, see comment:1), though things may still change when it comes to the defaults we ship, as per #1129.
Uhh... not familiar enough with manually manipulating my sockets to know where to start trying to break it.
I'll go ahead and close and maybe open a new one if I can learn enough to be socket-dangerous at some point in the future.
this ticket has been moved to: https://github.com/Xpra-org/xpra/issues/963