[PATCH weston] weston-launch: Do not run weston in a shell

Pekka Paalanen ppaalanen at gmail.com
Fri Mar 7 05:12:06 PST 2014


On Thu,  6 Mar 2014 17:25:49 +0100
Quentin Glidic <sardemff7+wayland at sardemff7.net> wrote:

> From: Quentin Glidic <sardemff7+git at sardemff7.net>
> 
> Since 636156d5f693ac5b01cec6a2937d2b6cd4237ea9 it is not needed any
> more to allow the user to pass environment to weston. Actually, the
> login shell is wiping parts of the environment.
> 
> Signed-off-by: Quentin Glidic <sardemff7+git at sardemff7.net>
> ---
> 
> Then we should remove the shell invocation alltogether.
> 
> I still need a way to run things at weston’s start and stop,
> but that can wait for another patch.
> 
>  src/weston-launch.c | 12 ++++--------
>  1 file changed, 4 insertions(+), 8 deletions(-)
> 
> diff --git a/src/weston-launch.c b/src/weston-launch.c
> index 56e22b1..1f67557 100644
> --- a/src/weston-launch.c
> +++ b/src/weston-launch.c
> @@ -644,16 +644,12 @@ launch_compositor(struct weston_launch *wl, int
> argc, char *argv[]) sigaddset(&mask, SIGINT);
>  	sigprocmask(SIG_UNBLOCK, &mask, NULL);
>  
> -	child_argv[0] = "/bin/sh";
> -	child_argv[1] = "-l";
> -	child_argv[2] = "-c";
> -	child_argv[3] = BINDIR "/weston \"$@\"";
> -	child_argv[4] = "weston";
> +	child_argv[0] = BINDIR "/weston";
>  	for (i = 0; i < argc; ++i)
> -		child_argv[5 + i] = argv[i];
> -	child_argv[5 + i] = NULL;
> +		child_argv[1 + i] = argv[i];
> +	child_argv[1 + i] = NULL;
>  
> -	execv(child_argv[0], child_argv);
> +	execv("weston", child_argv);
>  	error(1, errno, "exec failed");
>  }
>  

Hi,

Quentin pointed out that weston-launch no longer wipes the environment
if ran without -u, so I guess that would be enough to keep my weston
setup running.

I install everything into a $prefix under my homedir, including
libwayland and Mesa, so I need some environment variables to make that
run. I use the same approach when developing for RPi, too.

There was some talk about wiping the environment for Weston in the
future, and starting the clients through a freshly initialized user
shell. In such case, we would need something like a minimal environment
setup compiled into weston-launch binary, set during ./configure or
something.

I thought I'd mention this, since I have interest in keeping my
development environment running without running everything as root. I
also have not migrated my workstation to systemd yet, nor is Raspbian,
so the logind integration doesn't help me.


Thanks,
pq


More information about the wayland-devel mailing list