Bug#747180: [kde-workspace-bin] due to checkSystemdVersion()

2014-11-04 Thread Martin Pitt
Control: tag -1 fixed-upstream pending

Hey Török,

Török Edwin [2014-10-21 20:31 +0300]:
> +  return g_variant_new_take_string (g_strdup_printf("systemd %d", 
> SYSTEMD_VERSION));

This is wrong, systemd only gives back the version without the
"systemd " prefix. I adjusted the patch accordingly and pushed
upstream:

 https://github.com/desrt/systemd-shim/commit/dd8c6a1a7

Thanks!

Martin

-- 
Martin Pitt| http://www.piware.de
Ubuntu Developer (www.ubuntu.com)  | Debian Developer  (www.debian.org)


signature.asc
Description: Digital signature


Bug#747180: [kde-workspace-bin] due to checkSystemdVersion()

2014-10-21 Thread Török Edwin
Package: kde-workspace-bin
Version: 4:4.11.13-1

--- Please enter the report below this line. ---

Summary: KDE reads the Version property of org.freedesktop.systemd1.Manager 
interface and hides the Suspend/Hibernate buttons if it is not new enough, but 
systemd-shim doesn't implement that property.
Attached is a patch for systemd-shim to workaround this issue.

Looking through ./powerdevil/daemon/backends/upower/powerdevilupowerbackend.cpp 
there are 2 implementations,
one using the login1 interface, another using upower:

if (m_login1Interface && checkSystemdVersion(195)) {
...
} else {
if (m_upowerInterface->canSuspend() && 
m_upowerInterface->SuspendAllowed()) {
...
}

upower in its latest version doesn't support suspend/resume anymore so we'd 
want to use the login1 interface.
This seems to be provide by systemd-shim, and says that Suspend is supported:
$ qdbus --system org.freedesktop.login1 /org/freedesktop/login1 
org.freedesktop.login1.Manager.CanSuspend
yes
$ qdbus --system org.freedesktop.login1 /org/freedesktop/login1 
org.freedesktop.login1.Manager.CanSuspend
yes

KDE also does a version check on the interface though, which is this code:

QDBusInterface systemdIface("org.freedesktop.systemd1", 
"/org/freedesktop/systemd1", "org.freedesktop.systemd1.Manager",
QDBusConnection::systemBus(), 0);
const QString reply = systemdIface.property("Version").toString();
QRegExp expsd("(systemd )?([0-9]+)");

systemd-shim doesn't implement Version in org.freedesktop.systemd1.Manager:
$ dbus-send --system --print-reply --type=method_call 
--dest="org.freedesktop.systemd1" /org/freedesktop/systemd1 
org.freedesktop.DBus.Properties.Get string:"org.freedesktop.systemd1.Manager" 
string:Version
$ qdbus --system org.freedesktop.systemd1 /org/freedesktop/systemd1 
org.freedesktop.DBus.Properties.Get org.freedesktop.systemd1.Manager Version
Error: org.freedesktop.DBus.Error.InvalidArgs
No such property 'Version'

According to the documentation[0] the Version property is NOT part of the API, 
so KDE would be wrong for using it...

However as a quick workaround I patched systemd-shim to provide the Version 
property:
$ apt-get source systemd-shim && cd systemd-shim-8
$ quilt import ~/add-manager-version.patch
$ quilt push -a
$ dpkg-buildpackage -us -uc
$ sudo dpkg -i ../systemd-shim_8-3_amd64.deb

Reboot (the menu entry would show up after restarting dbus and logout/login, 
but the Suspend method would give permission denied,
probably more things need to be restarted).

Now there is a Sleep entry in the Leave menu!

I have reported a bug at upstream KDE about using the 'Version' property: 
https://bugs.kde.org/show_bug.cgi?id=340206

[0] http://www.freedesktop.org/wiki/Software/systemd/dbus/

--- System information. ---
Architecture: amd64
Kernel:   Linux 3.16-2-amd64

Debian Release: jessie/sid
  500 unstableftp.ro.debian.org 
  500 testing ftp.ro.debian.org 
1 experimentalftp.ro.debian.org 

--- Package information. ---
Depends (Version) | Installed
=-+-=
iso-codes | 3.56-1
kde-runtime (>= 4:4.10.2) | 4:4.14.1-1+b1
kde-workspace-data(= 4:4.11.11-1) | 4:4.11.13-1
kde-workspace-kgreet-plugins  (= 4:4.11.11-1) | 4:4.11.13-1
kscreen   | 1.0.2.1-1
plasma-desktop   (= 4:4.11.11-1)  | 4:4.11.13-1
 OR plasma-netbook(= 4:4.11.11-1) | 4:4.11.13-1
qdbus | 
4:4.8.6+git64-g5dc8b2b+dfsg-2+b1
x11-utils | 7.7+2
x11-xserver-utils | 7.7+3
kde-style-oxygen  (= 4:4.11.11-1) | 4:4.11.13-1
libc6   (>= 2.15) | 
libcln6   | 
libdbusmenu-qt2(>= 0.6.0) | 
libfontconfig1  (>= 2.11) | 
libfreetype6   (>= 2.2.1) | 
libgcc1  (>= 1:4.1.1) | 
libgl1-mesa-glx   | 
 OR libgl1| 
libice6  (>= 1:1.0.0) | 
libjpeg8  (>= 8c) | 
libkactivities6   (>= 4:4.11) | 
libkcmutils4  (>= 4:4.11) | 
libkdeclarative5 (>= 4:4.7.0) | 
libkdecore5   (>= 4:4.11) | 
libkdesu5 (>= 4:4.11) | 
libkdeui5 (>= 4:4.11) | 
libkfile4 (>= 4:4.11) | 
libkidletime4 (>= 4:4.11) | 
libkio5   (>= 4:4.11) | 
libknewstuff3-4   (>= 4:4.11) | 
libknotifyconfig4 (>= 4:4.11) | 
libkparts4