[KDE/Mac] [kconfig] /: Fix kconf_update for spaces in paths

David Faure faure at kde.org
Fri May 1 22:18:21 UTC 2015


Git commit 76e5b4412782b9c1757c8cdb3984f99566a57b96 by David Faure.
Committed on 01/05/2015 at 22:16.
Pushed by dfaure into branch 'master'.

Fix kconf_update for spaces in paths

(CI says it happens on OSX)
Unittest it on Linux by exporting XDG_DATA_HOME with a space in it.

CCMAIL: kde-mac at kde.org

M  +6    -0    autotests/test_kconf_update.cpp
M  +1    -0    autotests/test_kconf_update.h
M  +5    -4    src/kconf_update/kconf_update.cpp

http://commits.kde.org/kconfig/76e5b4412782b9c1757c8cdb3984f99566a57b96

diff --git a/autotests/test_kconf_update.cpp b/autotests/test_kconf_update.cpp
index 86553a2..baa4dc5 100644
--- a/autotests/test_kconf_update.cpp
+++ b/autotests/test_kconf_update.cpp
@@ -33,6 +33,12 @@
 
 QTEST_GUILESS_MAIN(TestKConfUpdate)
 
+void TestKConfUpdate::initTestCase()
+{
+    // Ensure it all works with spaces in paths (as happens more commonly on OSX where it's ~/Library/Application Support/)
+    qputenv("XDG_DATA_HOME", "/tmp/a b");
+}
+
 static void writeFile(const QString &path, const QString &content)
 {
     QFile file(path);
diff --git a/autotests/test_kconf_update.h b/autotests/test_kconf_update.h
index 1b3151f..ca8fe3b 100644
--- a/autotests/test_kconf_update.h
+++ b/autotests/test_kconf_update.h
@@ -27,6 +27,7 @@ class TestKConfUpdate : public QObject
 {
     Q_OBJECT
 private Q_SLOTS:
+    void initTestCase();
     void test_data();
     void test();
     void testScript_data();
diff --git a/src/kconf_update/kconf_update.cpp b/src/kconf_update/kconf_update.cpp
index 309bc3c..7659e7b 100644
--- a/src/kconf_update/kconf_update.cpp
+++ b/src/kconf_update/kconf_update.cpp
@@ -777,6 +777,7 @@ void KonfUpdate::gotScript(const QString &_script)
         log() << m_currentFilename << ": Running script '" << script << "'" << endl;
     }
 
+    QStringList args;
     QString cmd;
     if (interpreter.isEmpty()) {
         cmd = path;
@@ -787,12 +788,12 @@ void KonfUpdate::gotScript(const QString &_script)
             m_skip = true;
             return;
         }
-        cmd = interpreterPath + ' ' + path;
+        cmd = interpreterPath;
+        args << path;
     }
 
     if (!m_arguments.isNull()) {
-        cmd += ' ';
-        cmd += m_arguments;
+        args += m_arguments;
     }
 
     QTemporaryFile scriptIn;
@@ -834,7 +835,7 @@ void KonfUpdate::gotScript(const QString &_script)
             log() << "Script contents is:" << endl << scriptFile.readAll() << endl;
         }
     }
-    proc.start(cmd);
+    proc.start(cmd, args);
     if (!proc.waitForFinished(60000)) {
         logFileError() << "update script did not terminate within 60 seconds: " << cmd << endl;
         m_skip = true;


More information about the kde-mac mailing list