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

Kevin Kofler kkofler at fedoraproject.org
Sat Feb 2 18:50:05 UTC 2013


commit b3b40722c8791b3cd136db5566497b542e4992da
Author: Kevin Kofler <Kevin at tigcc.ticalc.org>
Date:   Sat Feb 2 19:49:53 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.8.5-3
    - 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 794cf12..c9242ee 100644
--- a/kde-workspace.spec
+++ b/kde-workspace.spec
@@ -11,7 +11,7 @@
 Summary: KDE Workspace
 Name:    kde-workspace
 Version: 4.8.5
-Release: 2%{?dist}
+Release: 3%{?dist}
 
 License: GPLv2
 URL:     https://projects.kde.org/projects/kde/kde-workspace
@@ -100,6 +100,9 @@ Patch57: kde-workspace-4.8.0-bug796969.patch
 # initial systemd support
 Patch58: kde-workspace-4.8.0-systemd-shutdown.patch
 
+# fix kcmdatetimehelper search path so hwclock and zic are found (#906854)
+Patch63: kde-workspace-4.10.0-#906854.patch
+
 ## upstream patches
 Patch100: kde-workspace-4.9-tasks_attention.patch
 Patch101: kde-workspace-4.9-taskmanager_attention.patch
@@ -428,6 +431,7 @@ Requires: akonadi
 #patch56 -p1 -b .kwin_llvmpipe_whitelist
 %patch57 -p1 -b .bug796969
 %patch58 -p1 -b .systemd-shutdown
+%patch63 -p1 -b .#906854
 
 # upstream patches
 %patch100 -p1 -b .tasks_attention
@@ -979,6 +983,9 @@ fi
 
 
 %changelog
+* Sat Feb 02 2013 Kevin Kofler <Kevin at tigcc.ticalc.org> - 4.8.5-3
+- fix kcmdatetimehelper search path so hwclock and zic are found (#906854)
+
 * Tue Aug 07 2012 Rex Dieter <rdieter at fedoraproject.org> 4.8.5-2
 - window keeps status 'asking for attention' after gaining focus (kde#303208)
 


More information about the scm-commits mailing list