qmake: fix execution of depend_command in directories with funny names

it's wrong to use the escape function for makefiles, as the command
goes directly to a popen() call.

Task-number: QTBUG-57343
Change-Id: I34a8e4d8fb406303c593e7c1e24019e0f756e7f8
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
This commit is contained in:
Oswald Buddenhagen 2016-11-28 14:26:40 +01:00
parent 1e4054ce2f
commit e3ca4287d9
3 changed files with 14 additions and 3 deletions

View File

@ -1839,7 +1839,7 @@ MakefileGenerator::writeExtraCompilerTargets(QTextStream &t)
QString dep_cd_cmd;
if (!tmp_dep_cmd.isEmpty()) {
dep_cd_cmd = QLatin1String("cd ")
+ escapeFilePath(Option::fixPathToLocalOS(Option::output_dir, false))
+ IoUtils::shellQuote(Option::fixPathToLocalOS(Option::output_dir, false))
+ QLatin1String(" && ");
}
const ProStringList &vars = project->values(ProKey(*it + ".variables"));

View File

@ -29,10 +29,15 @@
#include "msvc_objectmodel.h"
#include "msvc_vcproj.h"
#include "msvc_vcxproj.h"
#include <ioutils.h>
#include <qscopedpointer.h>
#include <qstringlist.h>
#include <qfileinfo.h>
using namespace QMakeInternal;
QT_BEGIN_NAMESPACE
// XML Tags ---------------------------------------------------------
@ -2318,7 +2323,7 @@ bool VCFilter::addExtraCompiler(const VCFilterFile &info)
tmp_dep_cmd, inFile, out, MakefileGenerator::LocalShell);
if(Project->canExecute(dep_cmd)) {
dep_cmd.prepend(QLatin1String("cd ")
+ Project->escapeFilePath(Option::fixPathToLocalOS(Option::output_dir, false))
+ IoUtils::shellQuote(Option::fixPathToLocalOS(Option::output_dir, false))
+ QLatin1String(" && "));
if (FILE *proc = QT_POPEN(dep_cmd.toLatin1().constData(), QT_POPEN_READ)) {
QString indeps;

View File

@ -29,16 +29,22 @@
#include "msvc_vcproj.h"
#include "option.h"
#include "xmloutput.h"
#include <ioutils.h>
#include <qdir.h>
#include <qdiriterator.h>
#include <qcryptographichash.h>
#include <qregexp.h>
#include <qhash.h>
#include <quuid.h>
#include <stdlib.h>
//#define DEBUG_SOLUTION_GEN
using namespace QMakeInternal;
QT_BEGIN_NAMESPACE
// Filter GUIDs (Do NOT change these!) ------------------------------
const char _GUIDSourceFiles[] = "{4FC737F1-C7A5-4376-A066-2A32D752A2FF}";
@ -1550,7 +1556,7 @@ void VcprojGenerator::initResourceFiles()
dep_cmd = Option::fixPathToLocalOS(dep_cmd, true, false);
if(canExecute(dep_cmd)) {
dep_cmd.prepend(QLatin1String("cd ")
+ escapeFilePath(Option::fixPathToLocalOS(Option::output_dir, false))
+ IoUtils::shellQuote(Option::fixPathToLocalOS(Option::output_dir, false))
+ QLatin1String(" && "));
if (FILE *proc = QT_POPEN(dep_cmd.toLatin1().constData(), QT_POPEN_READ)) {
QString indeps;