Accepting request 422149 from home:favogt:branches:X11:windowmanagers

Add patch icewm-exit-fork.patch to avoid deadlock (bsc#977233)

OBS-URL: https://build.opensuse.org/request/show/422149
OBS-URL: https://build.opensuse.org/package/show/X11:windowmanagers/icewm?expand=0&rev=67
This commit is contained in:
Tomáš Chvátal 2016-08-25 16:25:45 +00:00 committed by Git OBS Bridge
parent b6811f6643
commit f5249fe7fa
3 changed files with 72 additions and 0 deletions

64
icewm-exit-fork.patch Normal file
View File

@ -0,0 +1,64 @@
Author: Fabian Vogt <fvogt@suse.com>
Subject: Start shutdown and reboot commands in background
When polkit is enabled, systemctl may in turn wait for the
graphical password prompt to return. The created window cannot
be handled by icewm as it is busy with systemctl.
This avoids this deadlock by starting systemctl in background.
---
src/wmmgr.cc | 23 +++++++++++++++++++----
src/wmmgr.h | 1 +
2 files changed, 20 insertions(+), 4 deletions(-)
Index: icewm-1.3.12/src/wmmgr.cc
===================================================================
--- icewm-1.3.12.orig/src/wmmgr.cc
+++ icewm-1.3.12/src/wmmgr.cc
@@ -3011,16 +3011,30 @@ void YWindowManager::updateUserTime(Time
}
}
+void YWindowManager::execAfterFork(const char *command) {
+ pid_t pid = fork();
+ switch(pid) {
+ case -1: /* Failed */
+ warn("fork failed (%d)", errno);
+ return;
+ case 0: /* Child */
+ execl("/bin/sh", "sh", "-c", command, (char *) 0);
+ return; /* Never reached */
+ default: /* Parent */
+ return;
+ }
+}
+
void YWindowManager::checkLogout() {
if (fShuttingDown && !haveClients()) {
+ fShuttingDown = false; /* Only run the command once */
+
if (rebootOrShutdown == 1 && rebootCommand && rebootCommand[0]) {
msg("reboot... (%s)", rebootCommand);
- if (system(rebootCommand) == -1)
- return;
+ execAfterFork(rebootCommand);
} else if (rebootOrShutdown == 2 && shutdownCommand && shutdownCommand[0]) {
msg("shutdown ... (%s)", shutdownCommand);
- if (system(shutdownCommand) == -1)
- return;
+ execAfterFork(shutdownCommand);
} else
app->exit(0);
}
Index: icewm-1.3.12/src/wmmgr.h
===================================================================
--- icewm-1.3.12.orig/src/wmmgr.h
+++ icewm-1.3.12/src/wmmgr.h
@@ -188,6 +188,7 @@ public:
void wmCloseSession();
void exitAfterLastClient(bool shuttingDown);
+ void execAfterFork(const char *command);
void checkLogout();
virtual void resetColormap(bool active);

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Thu Aug 25 10:00:58 UTC 2016 - fvogt@suse.com
- Add patch icewm-exit-fork.patch to avoid deadlock (bsc#977233)
-------------------------------------------------------------------
Wed Aug 24 07:55:56 UTC 2016 - tyang@suse.com

View File

@ -32,6 +32,8 @@ Patch0: icewm-mate.patch
Patch1: icewm-susemenu.patch
# PATCH-FIX-UPSTREAM tweak the desktop session files to work correctly
Patch2: icewm-session-desktop.patch
# PATCH-FIX-OPENSUSE run shutdown and reboot in background
Patch3: icewm-exit-fork.patch
Patch99: icewm-preferences.patch
BuildRequires: autoconf
BuildRequires: automake
@ -134,6 +136,7 @@ mailbox status, and a digital clock. It is fast and small.
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
# Do not require needlessly new gettext.
sed -i 's/0.19.6/0.18.3/g' configure.ac