From 10b88f3f2039e1198a67275d0ee0b669e7b7b45c Mon Sep 17 00:00:00 2001 From: Assam Boudjelthia Date: Fri, 17 Jan 2025 13:36:09 +0200 Subject: [PATCH] AndroidDeployQt: explitly constuct the qmlDomCommand args list Construct the arguments list explicilty to QStringList to avoid calling QProcess::splitCommand() and potentially splitting a path with spaces that shouldn't, this also saves from having to deal with shell quotes. Fixes: QTBUG-132891 Pick-to: 6.8 Change-Id: I48f6c219830269c507f146b654bcfa025f0e3203 Reviewed-by: Olli Vuolteenaho Reviewed-by: Petri Virkkunen Reviewed-by: Soheil Armin (cherry picked from commit a8d8fb83ccfed09dd35dbab22caceaff963a3415) Reviewed-by: Qt Cherry-pick Bot --- src/tools/androiddeployqt/main.cpp | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/src/tools/androiddeployqt/main.cpp b/src/tools/androiddeployqt/main.cpp index 98f0b40062c..5b7153da52c 100644 --- a/src/tools/androiddeployqt/main.cpp +++ b/src/tools/androiddeployqt/main.cpp @@ -3611,17 +3611,14 @@ int generateJavaQmlComponents(const Options &options) const QString &qmlFile, const QStringList &otherImportPaths) -> QJsonObject { QByteArray domInfo; - QString importFlags; - for (auto &importPath : otherImportPaths) - importFlags.append(" -I %1"_L1.arg(shellQuote(importPath))); - - const QString qmlDomCmd = "%1 -d -D required -f +:propertyInfos %2 %3"_L1.arg( - shellQuote(qmlDomExecPath), importFlags, - shellQuote("%1/%2"_L1.arg(qmldirPath, qmlFile))); #if QT_CONFIG(process) - const QStringList qmlDomCmdParts = QProcess::splitCommand(qmlDomCmd); + QStringList qmlDomArgs {"-d"_L1, "-D"_L1, "required"_L1, "-f"_L1, "+:propertyInfos"_L1 }; + for (auto &importPath : otherImportPaths) + qmlDomArgs << "-I"_L1 << importPath; + qmlDomArgs << "%1/%2"_L1.arg(qmldirPath, qmlFile); + const QString qmlDomCmd = "%1 %2"_L1.arg(qmlDomExecPath, qmlDomArgs.join(u' ')); QProcess process; - process.start(qmlDomCmdParts.first(), qmlDomCmdParts.sliced(1)); + process.start(qmlDomExecPath, qmlDomArgs); if (!process.waitForStarted()) { fprintf(stderr, "Cannot execute command %s\n", qPrintable(qmlDomCmd)); return QJsonObject();