Accepting request 422188 from X11:windowmanagers

1

OBS-URL: https://build.opensuse.org/request/show/422188
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/icewm?expand=0&rev=49
This commit is contained in:
Dominique Leuenberger 2016-08-29 12:28:53 +00:00 committed by Git OBS Bridge
commit f7ef211418
4 changed files with 81 additions and 3 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

@ -44,11 +44,11 @@ Index: src/preferences
# Command to shutdown the system
-# ShutdownCommand="/bin/sh -c "{ test -e /run/systemd/system && systemctl poweroff; } ||:""
+ShutdownCommand="/bin/sh -c "systemctl poweroff ||:""
+ShutdownCommand="/bin/sh -c 'systemctl poweroff ||:'"
# Command to reboot the system
-# RebootCommand="/bin/sh -c "{ test -e /run/systemd/system && systemctl reboot; } ||:""
+RebootCommand="/bin/sh -c "systemctl reboot ||:""
+RebootCommand="/bin/sh -c 'systemctl reboot ||:'"
# Command to run on CPU status
# CPUStatusCommand="xterm -name top -title Process\ Status -e top"

View File

@ -1,3 +1,14 @@
-------------------------------------------------------------------
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
- Modify: icewm-preferences.patch
bnc#977233 modify the command to correct one.
-------------------------------------------------------------------
Thu Jun 2 11:30:11 UTC 2016 - tchvatal@suse.com

View File

@ -1,7 +1,7 @@
#
# spec file for package icewm
#
# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany.
# Copyright (c) 2016 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@ -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