adequately shell-escape generated sed commands
Change-Id: I39c8c4ab3da69bd21beace56f5cf3070301ac015 Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
This commit is contained in:
parent
56493268f7
commit
ef510adea5
@ -43,6 +43,9 @@
|
|||||||
#include "option.h"
|
#include "option.h"
|
||||||
#include "cachekeys.h"
|
#include "cachekeys.h"
|
||||||
#include "meta.h"
|
#include "meta.h"
|
||||||
|
|
||||||
|
#include <ioutils.h>
|
||||||
|
|
||||||
#include <qdir.h>
|
#include <qdir.h>
|
||||||
#include <qfile.h>
|
#include <qfile.h>
|
||||||
#include <qtextstream.h>
|
#include <qtextstream.h>
|
||||||
@ -52,6 +55,7 @@
|
|||||||
#include <qbuffer.h>
|
#include <qbuffer.h>
|
||||||
#include <qsettings.h>
|
#include <qsettings.h>
|
||||||
#include <qdatetime.h>
|
#include <qdatetime.h>
|
||||||
|
|
||||||
#if defined(Q_OS_UNIX)
|
#if defined(Q_OS_UNIX)
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#else
|
#else
|
||||||
@ -3345,11 +3349,17 @@ QString MakefileGenerator::installMetaFile(const ProKey &replace_rule, const QSt
|
|||||||
const ProString match = project->first(ProKey(replace_rules.at(r) + ".match")),
|
const ProString match = project->first(ProKey(replace_rules.at(r) + ".match")),
|
||||||
replace = project->first(ProKey(replace_rules.at(r) + ".replace"));
|
replace = project->first(ProKey(replace_rules.at(r) + ".replace"));
|
||||||
if (!match.isEmpty() /*&& match != replace*/)
|
if (!match.isEmpty() /*&& match != replace*/)
|
||||||
ret += " -e \"s," + match + "," + replace + ",g\"";
|
ret += " -e " + shellQuote("s," + match + "," + replace + ",g");
|
||||||
}
|
}
|
||||||
ret += " \"" + src + "\" >\"" + dst + "\"";
|
ret += " \"" + src + "\" >\"" + dst + "\"";
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString MakefileGenerator::shellQuote(const QString &str)
|
||||||
|
{
|
||||||
|
return isWindowsShell() ? QMakeInternal::IoUtils::shellQuoteWin(str)
|
||||||
|
: QMakeInternal::IoUtils::shellQuoteUnix(str);
|
||||||
|
}
|
||||||
|
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
@ -271,6 +271,7 @@ public:
|
|||||||
virtual bool mergeBuildProject(MakefileGenerator * /*other*/) { return false; }
|
virtual bool mergeBuildProject(MakefileGenerator * /*other*/) { return false; }
|
||||||
virtual bool openOutput(QFile &, const QString &build) const;
|
virtual bool openOutput(QFile &, const QString &build) const;
|
||||||
bool isWindowsShell() const { return Option::dir_sep == QLatin1String("\\"); }
|
bool isWindowsShell() const { return Option::dir_sep == QLatin1String("\\"); }
|
||||||
|
QString shellQuote(const QString &str);
|
||||||
};
|
};
|
||||||
|
|
||||||
inline void MakefileGenerator::setNoIO(bool o)
|
inline void MakefileGenerator::setNoIO(bool o)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user