-
Notifications
You must be signed in to change notification settings - Fork 341
xwayland: check executable exists on init #2314
Conversation
I don't like this patch. I would rather attempt to execute it and only set DISPLAY if it succeeds. |
Problem is, we execute Xwayland lazily. So if Xwayland doesn't exist, DISPLAY will be set, then apps will try to connect to it and hang forever. |
Maybe we can try running A strict reading of POSIX allows execvp to run programs which are found outside of the PATH variable. I'm also not certain that this interprets PATH 100% to spec. |
True. And execvp has implementation-defined behavior when PATH is unset. |
1b43cfe
to
a3c90dc
Compare
If the executable doesn't exist, fail early. This avoids setting an invalid DISPLAY env variable when Xwayland isn't installed.
Updated the check to use |
Meh. Maybe we should ditch lazy Xwayland, the benefits seem to be negligible. |
Hm, after thinking about it, non-lazy Xwayland wouldn't work either. When Xwayland is ready it'll send SIGUSR1. We wouldn't be able to know whether Xwayland is available before the signal, so we'd need to block for a potentially long time. |
So what is the right approach? |
What is the problem exactly? Here, you seem to be testing whether Xwayland runs at all, why do we need to wait for SIGUSR1? |
My goal was to find the best way to detect whether Xwayland is available before setting
None of those are great. |
Instead of walking PATH like a previous proposal [1], this one checks that the Xwayland path specified in the pkg-config file exists. I think this is a reasonable compromise: - Users that don't have Xwayland installed system-wide won't get a bogus DISPLAY env variable set up. - Users that have WLR_XWAYLAND set won't be affected by this check. - Users that have Xwayland installed system-wide and a different Xwayland in their PATH still get their custom Xwayland. - Users that don't have Xwayland installed system-wide but have it somewhere else in PATH are left out. But this is pretty niche, and they can just set WLR_XWAYLAND. [1]: swaywm#2314
Closing in favor of #2717. |
Instead of walking PATH like a previous proposal [1], this one checks that the Xwayland path specified in the pkg-config file exists. I think this is a reasonable compromise: - Users that don't have Xwayland installed system-wide won't get a bogus DISPLAY env variable set up. - Users that have WLR_XWAYLAND set won't be affected by this check. - Users that have Xwayland installed system-wide and a different Xwayland in their PATH still get their custom Xwayland. - Users that don't have Xwayland installed system-wide but have it somewhere else in PATH are left out. But this is pretty niche, and they can just set WLR_XWAYLAND. [1]: swaywm#2314
Instead of walking PATH like a previous proposal [1], this one checks that the Xwayland path specified in the pkg-config file exists. I think this is a reasonable compromise: - Users that don't have Xwayland installed system-wide won't get a bogus DISPLAY env variable set up. - Users that have WLR_XWAYLAND set won't be affected by this check. - Users that have Xwayland installed system-wide and a different Xwayland in their PATH still get their custom Xwayland. - Users that don't have Xwayland installed system-wide but have it somewhere else in PATH are left out. But this is pretty niche, and they can just set WLR_XWAYLAND. [1]: swaywm#2314
Instead of walking PATH like a previous proposal [1], this one checks that the Xwayland path specified in the pkg-config file exists. I think this is a reasonable compromise: - Users that don't have Xwayland installed system-wide won't get a bogus DISPLAY env variable set up. - Users that have WLR_XWAYLAND set won't be affected by this check. - Users that have Xwayland installed system-wide and a different Xwayland in their PATH still get their custom Xwayland. - Users that don't have Xwayland installed system-wide but have it somewhere else in PATH are left out. But this is pretty niche, and they can just set WLR_XWAYLAND. [1]: swaywm#2314
Instead of walking PATH like a previous proposal [1], this one checks that the Xwayland path specified in the pkg-config file exists. I think this is a reasonable compromise: - Users that don't have Xwayland installed system-wide won't get a bogus DISPLAY env variable set up. - Users that have WLR_XWAYLAND set won't be affected by this check. - Users that have Xwayland installed system-wide and a different Xwayland in their PATH still get their custom Xwayland. - Users that don't have Xwayland installed system-wide but have it somewhere else in PATH are left out. But this is pretty niche, and they can just set WLR_XWAYLAND. [1]: #2314
If the executable doesn't exist, fail early. This avoids setting an
invalid DISPLAY env variable when Xwayland isn't installed.