[PATH wayland] allow to set server socket dir on a different directory than XDG_RUNTIME_DIR

Bryce Harrington bryce at osg.samsung.com
Thu Feb 5 10:31:25 PST 2015


On Thu, Feb 05, 2015 at 11:14:09AM +0100, Bettio, Davide wrote:
> commit 68beb2b60f851c74b982b0a23da4bb1ce375efcf
> Author: Davide Bettio <davide.bettio at ispirata.com>
> Date:   Wed Feb 4 13:46:19 2015 +0100
> 
>     Allow to explicitly set wayland server socket dir using
> WAYLAND_SERVER_SOCKET_DIR

Could you elaborate further on why you'd use this, as opposed to say
controlling XDG_RUNTIME_DIR, or even manually establishing the socket
file and specifying it via WAYLAND_SOCKET?  (Not that I'm arguing we
don't need this, but rather to make sure we can clearly explain why a
user would use one mechanism vs. another.)

> diff --git a/src/wayland-server.c b/src/wayland-server.c
> index 674aeca..7eaba9e 100644
> --- a/src/wayland-server.c
> +++ b/src/wayland-server.c
> @@ -1080,9 +1080,12 @@ wl_socket_init_for_display_name(struct
> wl_socket *s, const char *name)
>  	int name_size;
>  	const char *runtime_dir;
> 
> -	runtime_dir = getenv("XDG_RUNTIME_DIR");
> +	runtime_dir = getenv("WAYLAND_SERVER_SOCKET_DIR");
>  	if (!runtime_dir) {
> -		wl_log("error: XDG_RUNTIME_DIR not set in the environment\n");
> +		runtime_dir = getenv("XDG_RUNTIME_DIR");
> +	}
> +	if (!runtime_dir) {
> +		wl_log("error: XDG_RUNTIME_DIR or WAYLAND_SERVER_SOCKET_DIR not
> set in the environment\n");
> 
>  		/* to prevent programs reporting
>  		 * "failed to add socket: Success" */
> 

This new feature needs documentation added.  There's several pieces of
documentation where XDG_RUNTIME_DIR is referenced; possibly some or all
of those should also mention this one.

    grep XDG_RUNTIME_DIR -sr doc

Please also include updates to socket-test.c - probably one or two new
test cases to cover this, and maybe update require_xdg_runtime_dir() if
this affects that.

test-runner.c references XDG_RUNTIME_DIR several places.  Looking
through this code, I don't *think* that there's a need for it to be
using WAYLAND_SERVER_SOCKET_DIR either instead or in addition.  Possibly
a tester might be surprised to find that WAYLAND_SERVER_SOCKET_DIR
honored in the case of running the test suite; but I'm not sure.
Offhand, the testsuite might benefit from using mktemp'd
WAYLAND_SERVER_SOCKET_DIR's instead of having to clean XDG_RUNTIME_DIR
out each test run.

Bryce



More information about the wayland-devel mailing list