From a945603f335e638301b291de0c8217790998a34b Mon Sep 17 00:00:00 2001 From: Olivier Fourdan Date: Tue, 9 Jul 2024 11:52:39 +0200 Subject: [PATCH] Backport fix for waitpid errors And suggests mutter since this is the default compositor. Resolves: https://issues.redhat.com/browse/RHEL-46355 --- ...headless-Ignore-os.waitpid-1-0-error.patch | 49 +++++++++++++++++++ xwayland-run.spec | 10 +++- 2 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 0001-wlheadless-Ignore-os.waitpid-1-0-error.patch diff --git a/0001-wlheadless-Ignore-os.waitpid-1-0-error.patch b/0001-wlheadless-Ignore-os.waitpid-1-0-error.patch new file mode 100644 index 0000000..9e3728f --- /dev/null +++ b/0001-wlheadless-Ignore-os.waitpid-1-0-error.patch @@ -0,0 +1,49 @@ +From 2f43fc2d1b57c7945576bf2950b236416c0403dd Mon Sep 17 00:00:00 2001 +From: Niels De Graef +Date: Thu, 4 Jul 2024 17:09:41 +0200 +Subject: [PATCH] wlheadless: Ignore os.waitpid(-1, 0) error + +There's a chance that all child processes have already stopped running +by the time we're cleaning up. If we then try to wait on child processes +to finish (using `os.waitpid(-1, 0)`, the function will throw a +`ChildProcessError`, which makes the whole script fail, with the +following error message: + +``` +Traceback (most recent call last): + File "/usr/bin/wlheadless-run", line 90, in + wlheadless_common.cleanup() + ~~~~~~~~~~~~~~~~~~~~~~~~~^^ + File "/usr/lib/python3.13/site-packages/wlheadless/wlheadless_common.py", line 151, in cleanup + self.__cleanup_tempdir() + ~~~~~~~~~~~~~~~~~~~~~~^^ + File "/usr/lib/python3.13/site-packages/wlheadless/wlheadless_common.py", line 136, in __cleanup_tempdir + os.waitpid(-1, 0) + ~~~~~~~~~~^^^^^^^ +ChildProcessError: [Errno 10] No child processes +``` + +Just ignore the error if it happens. +--- + src/wlheadless/wlheadless_common.py | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/src/wlheadless/wlheadless_common.py b/src/wlheadless/wlheadless_common.py +index 556c0f7..d056f3b 100644 +--- a/src/wlheadless/wlheadless_common.py ++++ b/src/wlheadless/wlheadless_common.py +@@ -133,7 +133,10 @@ class WlheadlessCommon: + def __cleanup_tempdir(self): + """ Removes our temporary XDG_RUNTIME_DIR directory if empty. """ + if self.xdg_runtime_dir: +- os.waitpid(-1, 0) ++ try: ++ os.waitpid(-1, 0) ++ except ChildProcessError: ++ pass + try: + rmtree(self.xdg_runtime_dir) + except OSError as error: +-- +2.45.2 + diff --git a/xwayland-run.spec b/xwayland-run.spec index ea7a65b..1577121 100644 --- a/xwayland-run.spec +++ b/xwayland-run.spec @@ -1,12 +1,15 @@ Name: xwayland-run Version: 0.0.4 -Release: 1%{?dist} +Release: 2%{?dist} Summary: Set of utilities to run headless X/Wayland clients License: GPL-2.0-or-later URL: https://gitlab.freedesktop.org/ofourdan/xwayland-run Source0: %{url}/-/archive/%{version}/%{name}-%{version}.tar.bz2 +# https://gitlab.freedesktop.org/ofourdan/xwayland-run/-/merge_requests/19 +Patch1: 0001-wlheadless-Ignore-os.waitpid-1-0-error.patch + BuildArch: noarch BuildRequires: meson >= 0.60.0 @@ -16,6 +19,7 @@ Requires: (weston or cage or kwin-wayland or mutter or gnome-kiosk) Requires: xorg-x11-server-Xwayland Requires: xorg-x11-xauth Requires: dbus-daemon +Suggests: mutter # Provide names of the other utilities included Provides: wlheadless-run = %{version}-%{release} @@ -53,6 +57,10 @@ Xwayland and various Wayland compositor headless. %changelog +* Tue Jul 09 2024 Olivier Fourdan - 0.0.4-2 +- Backport fix for waitpid errors (RHEL-46355) +- Suggest mutter since this is the default compositor + * Mon Jul 1 2024 Olivier Fourdan - 0.0.4-1 - Update to 0.0.4 - Require xorg-x11-xauth and dbus-daemon