Xwayland not sending SIGUSR1 when smart parent is PID1 (e.g. weston run as container)
Hello, I've run into a weird bug running weston in its own container with podman, e.g. something like the following:
$ podman run --device /dev/tty1 --device=/dev/dri --device=/dev/input \
--env=XDG_RUNTIME_DIR=/run/xdg_runtime --cap-add=SYS_TTY_CONFIG \
--volume=/run/xdg_runtime:/run/xdg_runtime \
--volume=/tmp/.X11-unix:/tmp/.X11-unix \
localhost/xwayland:latest weston --tty 1
which means weston, PID1, starts xwayland so while SIGUSR1 is ignored and RunFromSmartParent
detection is set to TRUE, the signal isn't sent:
void
NotifyParentProcess(void)
{
...
if (RunFromSmartParent) {
if (ParentProcess > 1) {
kill(ParentProcess, SIGUSR1);
}
}
if (RunFromSigStopParent)
raise(SIGSTOP);
I appreciate a better solution would be to have weston use the displayfd mechanism, which is a fix that entirely belongs in weston, but the original check for ParentProcess > 1 (in d5682217) does not have any rationale so I'd like to understand that first -- this might have made sense if some old init system triggered the wrong things, but in that case it'd be more flexible to e.g. only set RunFromSmartParent if ppid > 1, add a command line switch to force it like RunFromSigStopParent, and send the signal when flag is set perhaps?
Well, as said either way I'll be looking into making weston use -displayfd instead so ultimately it doesn't matter, but I've wasted a few days figuring out why xwayland wouldn't work in these specific conditions so hopefully at least the issue will help someone...
Thanks!