Backport fix for waitpid errors

And suggests mutter since this is the default compositor.

Resolves: https://issues.redhat.com/browse/RHEL-46355
This commit is contained in:
Olivier Fourdan 2024-07-09 11:52:39 +02:00
parent bce91d12e6
commit a945603f33
2 changed files with 58 additions and 1 deletions

View File

@ -0,0 +1,49 @@
From 2f43fc2d1b57c7945576bf2950b236416c0403dd Mon Sep 17 00:00:00 2001
From: Niels De Graef <ndegraef@redhat.com>
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 <module>
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

View File

@ -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 <ofourdan@redhat.com> - 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 <ofourdan@redhat.com> - 0.0.4-1
- Update to 0.0.4
- Require xorg-x11-xauth and dbus-daemon