Skip to content
Snippets Groups Projects
Commit 08797858 authored by Christian Kandeler's avatar Christian Kandeler
Browse files

RemoteLinux: Fix upload for target file paths with spaces.


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: default avatarEike Ziller <eike.ziller@theqtcompany.com>
Reviewed-by: Karsten Sperling Opdal
Reviewed-by: default avatarChristian Kandeler <christian.kandeler@theqtcompany.com>
parent 29d81424
No related branches found
Tags v3.4.1
No related merge requests found
......@@ -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()));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment