Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG#2024] fixed crypto/Qt version issues for ubuntu 20.04 compile. #2025

Merged
merged 2 commits into from
Oct 10, 2024

Conversation

ElonKou
Copy link
Contributor

@ElonKou ElonKou commented Oct 8, 2024

As #2024 , we fixd the BUG of compiling of ubuntu 20.04.

  • add a crypto library insatll command for ubuntu 20.04.
  • support ubuntu 20.04's default crypto version for compiling.
  • fixed the problem which ubuntu 20.04's default Qt 5.12 version has no splitCommand function.

Related issue number (if any) = #2024

@legobadman
Copy link
Contributor

this is the implement of splitCommand, you can copy that.

QStringList QProcess::splitCommand(QStringView command)
{
QStringList args;
QString tmp;
int quoteCount = 0;
bool inQuote = false;

// handle quoting. tokens can be surrounded by double quotes
// "hello world". three consecutive double quotes represent
// the quote character itself.
for (int i = 0; i < command.size(); ++i) {
    if (command.at(i) == QLatin1Char('"')) {
        ++quoteCount;
        if (quoteCount == 3) {
            // third consecutive quote
            quoteCount = 0;
            tmp += command.at(i);
        }
        continue;
    }
    if (quoteCount) {
        if (quoteCount == 1)
            inQuote = !inQuote;
        quoteCount = 0;
    }
    if (!inQuote && command.at(i).isSpace()) {
        if (!tmp.isEmpty()) {
            args += tmp;
            tmp.clear();
        }
    } else {
        tmp += command.at(i);
    }
}
if (!tmp.isEmpty())
    args += tmp;

return args;

}

@ElonKou
Copy link
Contributor Author

ElonKou commented Oct 9, 2024

@legobadman Thanks for your reply, I solved the problem using auto cmdArgs = cmd.split(QRegularExpression("\s+"), QString::SkipEmptyParts);. If the splitCommand function is added and merged into the main branch, it may cause conflicts for users using Qt6.

@legobadman
Copy link
Contributor

@legobadman Thanks for your reply, I solved the problem using auto cmdArgs = cmd.split(QRegularExpression("\s+"), QString::SkipEmptyParts);. If the splitCommand function is added and merged into the main branch, it may cause conflicts for users using Qt6.

but we need to consider the case which the command has quote, not only space. you can copy the code of QProcess::splitCommand.

by the way, we recommand choose Qt5.15 or 5.14, it's not easy to switch different version of qt.

@ElonKou
Copy link
Contributor Author

ElonKou commented Oct 9, 2024

@legobadman OK, I just copy the QProcess::splitCommand function in my local code, thank you.

@legobadman legobadman merged commit 1f1e308 into zenustech:master Oct 10, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants