Fix #184 segfault caused by trying to copy copyright files
This commit is contained in:
@@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user