aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Kandeler <christian.kandeler@theqtcompany.com>2015-05-28 17:48:49 +0200
committerChristian Kandeler <christian.kandeler@theqtcompany.com>2015-05-29 08:23:25 +0000
commit0879785839f195c9f90ae6196e022a5072d623a3 (patch)
treefc2b6abd984f4048bed330f39c7fa862643704e7
parent29d81424a2e5387591582f4d4a8af994cde9eb77 (diff)
RemoteLinux: Fix upload for target file paths with spaces.v3.4.1
In addition to causing an unhelpful error message, we would also create directories at unwanted places. For instance, deploying to a directory called "/tmp/test dir" would result in this: mkdir -p /tmp/test dir Which created two unwanted directories, one of them at a completely unrelated place. Task-number: QTCREATORBUG-14518 Change-Id: Ie1c287ca73d0815b9bed335141adb901e361e3e6 Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com> Reviewed-by: Karsten Sperling Opdal Reviewed-by: Christian Kandeler <christian.kandeler@theqtcompany.com>
-rw-r--r--src/plugins/remotelinux/genericdirectuploadservice.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/plugins/remotelinux/genericdirectuploadservice.cpp b/src/plugins/remotelinux/genericdirectuploadservice.cpp
index dd9d1f93a7..a5852ade3a 100644
--- a/src/plugins/remotelinux/genericdirectuploadservice.cpp
+++ b/src/plugins/remotelinux/genericdirectuploadservice.cpp
@@ -31,6 +31,7 @@
#include <projectexplorer/deployablefile.h>
#include <utils/qtcassert.h>
+#include <utils/qtcprocess.h>
#include <ssh/sftpchannel.h>
#include <ssh/sshconnection.h>
#include <ssh/sshremoteprocess.h>
@@ -184,7 +185,8 @@ void GenericDirectUploadService::handleUploadFinished(SftpJobId jobId, const QSt
// This is done for Windows.
if (df.isExecutable()) {
- const QString command = QLatin1String("chmod a+x ") + df.remoteFilePath();
+ const QString command = QLatin1String("chmod a+x ")
+ + Utils::QtcProcess::quoteArgUnix(df.remoteFilePath());
d->chmodProc = connection()->createRemoteProcess(command.toUtf8());
connect(d->chmodProc.data(), SIGNAL(closed(int)), SLOT(handleChmodFinished(int)));
connect(d->chmodProc.data(), SIGNAL(readyReadStandardOutput()),
@@ -263,8 +265,9 @@ void GenericDirectUploadService::handleMkdirFinished(int exitStatus)
const QString remoteFilePath = df.remoteDirectory() + QLatin1Char('/') + fi.fileName();
if (fi.isSymLink()) {
const QString target = fi.dir().relativeFilePath(fi.symLinkTarget()); // see QTBUG-5817.
- const QString command = QLatin1String("ln -sf ") + target + QLatin1Char(' ')
- + remoteFilePath;
+ const QStringList args = QStringList() << QLatin1String("ln") << QLatin1String("-sf")
+ << target << remoteFilePath;
+ const QString command = Utils::QtcProcess::joinArgs(args, Utils::OsTypeLinux);
// See comment in SftpChannel::createLink as to why we can't use it.
d->lnProc = connection()->createRemoteProcess(command.toUtf8());
@@ -370,7 +373,8 @@ void GenericDirectUploadService::uploadNextFile()
QFileInfo fi = df.localFilePath().toFileInfo();
if (fi.isDir())
dirToCreate += QLatin1Char('/') + fi.fileName();
- const QString command = QLatin1String("mkdir -p ") + dirToCreate;
+ const QString command = QLatin1String("mkdir -p ")
+ + Utils::QtcProcess::quoteArgUnix(dirToCreate);
d->mkdirProc = connection()->createRemoteProcess(command.toUtf8());
connect(d->mkdirProc.data(), SIGNAL(closed(int)), SLOT(handleMkdirFinished(int)));
connect(d->mkdirProc.data(), SIGNAL(readyReadStandardOutput()), SLOT(handleStdOutData()));