From e3ca4287d99a8b1a5769c19b97679cd95b4e83e4 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Mon, 28 Nov 2016 14:26:40 +0100 Subject: [PATCH] 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 --- qmake/generators/makefile.cpp | 2 +- qmake/generators/win32/msvc_objectmodel.cpp | 7 ++++++- qmake/generators/win32/msvc_vcproj.cpp | 8 +++++++- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp index 4450e619b9..1ba2587bd0 100644 --- a/qmake/generators/makefile.cpp +++ b/qmake/generators/makefile.cpp @@ -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")); diff --git a/qmake/generators/win32/msvc_objectmodel.cpp b/qmake/generators/win32/msvc_objectmodel.cpp index fb9c4f354d..2c57fcc2f5 100644 --- a/qmake/generators/win32/msvc_objectmodel.cpp +++ b/qmake/generators/win32/msvc_objectmodel.cpp @@ -29,10 +29,15 @@ #include "msvc_objectmodel.h" #include "msvc_vcproj.h" #include "msvc_vcxproj.h" + +#include + #include #include #include +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; diff --git a/qmake/generators/win32/msvc_vcproj.cpp b/qmake/generators/win32/msvc_vcproj.cpp index 7b3d7fd160..018c70089d 100644 --- a/qmake/generators/win32/msvc_vcproj.cpp +++ b/qmake/generators/win32/msvc_vcproj.cpp @@ -29,16 +29,22 @@ #include "msvc_vcproj.h" #include "option.h" #include "xmloutput.h" + +#include + #include #include #include #include #include #include + #include //#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;