[kde-workspace] fix kcmdatetimehelper search path so hwclock and zic are found (#906854)

Kevin Kofler kkofler at fedoraproject.org
Sat Feb 2 01:26:48 UTC 2013


commit e0c5837ce16e44363994f34433af56db2766bdae
Author: Kevin Kofler <Kevin at tigcc.ticalc.org>
Date:   Sat Feb 2 02:26:19 2013 +0100

    fix kcmdatetimehelper search path so hwclock and zic are found (#906854)
    
    * Sat Feb 02 2013 Kevin Kofler <Kevin at tigcc.ticalc.org> - 4.10.0-2
    - fix kcmdatetimehelper search path so hwclock and zic are found (#906854)

 kde-workspace-4.10.0-#906854.patch |   58 ++++++++++++++++++++++++++++++++++++
 kde-workspace.spec                 |    9 +++++-
 2 files changed, 66 insertions(+), 1 deletions(-)
---
diff --git a/kde-workspace-4.10.0-#906854.patch b/kde-workspace-4.10.0-#906854.patch
new file mode 100644
index 0000000..4ab6fc9
--- /dev/null
+++ b/kde-workspace-4.10.0-#906854.patch
@@ -0,0 +1,58 @@
+From 70505b9c7871b174e6f5bf1fb3d17b4e5fab14af Mon Sep 17 00:00:00 2001
+Message-Id: <70505b9c7871b174e6f5bf1fb3d17b4e5fab14af.1359767724.git.kevin.kofler at chello.at>
+From: Kevin Kofler <kevin.kofler at chello.at>
+Date: Sat, 2 Feb 2013 01:59:45 +0100
+Subject: [PATCH] kcmdatetimehelper: Hardcode PATH because $PATH is empty
+ here.
+
+Unfortunately, we cannot rely on the $PATH environment variable in KAuth
+helpers, because D-Bus activation clears it. So we have to use a
+reasonable default for the KStandardDirs::findExe search path, and
+actually use the return value of KStandardDirs::findExe in the calls to
+KProcess::execute.
+---
+ kcontrol/dateandtime/helper.cpp |   14 ++++++++++----
+ 1 files changed, 10 insertions(+), 4 deletions(-)
+
+diff --git a/kcontrol/dateandtime/helper.cpp b/kcontrol/dateandtime/helper.cpp
+index 5a946d8..9168db3 100644
+--- a/kcontrol/dateandtime/helper.cpp
++++ b/kcontrol/dateandtime/helper.cpp
+@@ -48,6 +48,10 @@
+ #include <sys/stat.h>
+ #endif
+ 
++// We cannot rely on the $PATH environment variable, because D-Bus activation
++// clears it. So we have to use a reasonable default.
++static const QString exePath = QLatin1String("/usr/sbin:/usr/bin:/sbin:/bin");
++
+ int ClockHelper::ntp( const QStringList& ntpServers, bool ntpEnabled,
+                       const QString& ntpUtility )
+ {
+@@ -96,8 +100,9 @@ int ClockHelper::date( const QString& newdate, const QString& olddate )
+         return DateError;
+     }
+ 
+-    if (!KStandardDirs::findExe("hwclock").isEmpty()) {
+-        KProcess::execute("hwclock", QStringList() << "--systohc");
++    QString hwclock = KStandardDirs::findExe("hwclock", exePath);
++    if (!hwclock.isEmpty()) {
++        KProcess::execute(hwclock, QStringList() << "--systohc");
+     }
+     return 0;
+ }
+@@ -172,8 +177,9 @@ int ClockHelper::tz( const QString& selectedzone )
+ #else
+         QString tz = "/usr/share/zoneinfo/" + selectedzone;
+ 
+-        if( !KStandardDirs::findExe( "zic" ).isEmpty()) {
+-            KProcess::execute("zic", QStringList() << "-l" << selectedzone);
++        QString zic = KStandardDirs::findExe("zic", exePath);
++        if (!zic.isEmpty()) {
++            KProcess::execute(zic, QStringList() << "-l" << selectedzone);
+         } else if (!QFile::remove("/etc/localtime")) {
+           ret |= TimezoneError;
+         } else if (!QFile::copy(tz, "/etc/localtime")) {
+-- 
+1.7.7.6
+
diff --git a/kde-workspace.spec b/kde-workspace.spec
index f9b68d3..198e63a 100644
--- a/kde-workspace.spec
+++ b/kde-workspace.spec
@@ -9,7 +9,7 @@
 Summary: KDE Workspace
 Name:    kde-workspace
 Version: 4.10.0
-Release: 1%{?dist}
+Release: 2%{?dist}
 
 License: GPLv2
 URL:     https://projects.kde.org/projects/kde/kde-workspace
@@ -108,6 +108,9 @@ Patch57: kde-workspace-4.8.0-bug796969.patch
 # Support for systemd AND ConsoleKit in kworkspace
 Patch62: kde-workspace-4.9.3-systemd-displaymanager.patch
 
+# fix kcmdatetimehelper search path so hwclock and zic are found (#906854)
+Patch63: kde-workspace-4.10.0-#906854.patch
+
 ## upstream patches
 
 ## plasma active patches
@@ -442,6 +445,7 @@ Requires: akonadi
 %endif
 %patch57 -p1 -b .bug796969
 %patch62 -p0 -b .systemd-displaymanager
+%patch63 -p1 -b .#906854
 
 # upstream patches
 
@@ -979,6 +983,9 @@ fi
 
 
 %changelog
+* Sat Feb 02 2013 Kevin Kofler <Kevin at tigcc.ticalc.org> - 4.10.0-2
+- fix kcmdatetimehelper search path so hwclock and zic are found (#906854)
+
 * Thu Jan 31 2013 Rex Dieter <rdieter at fedoraproject.org> - 4.10.0-1
 - 4.10.0
 


More information about the scm-commits mailing list