Browse Source

Fix #184 segfault caused by trying to copy copyright files

master
probonopd 7 years ago
committed by GitHub
parent
commit
f135499521
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 14
      tools/linuxdeployqt/shared.cpp

14
tools/linuxdeployqt/shared.cpp

@ -290,6 +290,13 @@ bool copyCopyrightFile(QString libPath){
return false; return false;
} }
QString dpkgQueryPath;
dpkgQueryPath = QStandardPaths::findExecutable("dpkg");
if(dpkgQueryPath == ""){
LogNormal() << "dpkg-query not found, hence not deploying copyright files";
return false;
}
QString copyrightFilePath; QString copyrightFilePath;
/* Find out which package the file being deployed belongs to */ /* Find out which package the file being deployed belongs to */
@ -304,8 +311,8 @@ bool copyCopyrightFile(QString libPath){
if(strOut == "") return false; if(strOut == "") return false;
/* Find out the copyright file in that package */ /* Find out the copyright file in that package */
program = "dpkg-query";
arguments << "-S" << strOut; arguments << "-L" << strOut;
myProcess->start(program, arguments); myProcess->start(program, arguments);
myProcess->waitForFinished(); myProcess->waitForFinished();
strOut = myProcess->readAllStandardOutput(); strOut = myProcess->readAllStandardOutput();
@ -313,8 +320,9 @@ bool copyCopyrightFile(QString libPath){
QStringList outputLines = strOut.split("\n", QString::SkipEmptyParts); QStringList outputLines = strOut.split("\n", QString::SkipEmptyParts);
foreach (QString outputLine, outputLines) { foreach (QString outputLine, outputLines) {
if((outputLine.contains("usr/share/doc")) && (outputLine.contains("/copyright"))){ if((outputLine.contains("usr/share/doc")) && (outputLine.contains("/copyright")) && (outputLine.contains(" "))){
copyrightFilePath = outputLine.split(' ')[1]; copyrightFilePath = outputLine.split(' ')[1];
break;
} }
} }

Loading…
Cancel
Save