NOISSUE fix bug in unpacking of forge pack200 jar files
This caused failed downloads and broken files to be used.
This commit is contained in:
parent
f032e32133
commit
53b4bd019f
@ -4,7 +4,6 @@
|
|||||||
#include <QFile>
|
#include <QFile>
|
||||||
#include <QProcess>
|
#include <QProcess>
|
||||||
#include <QMap>
|
#include <QMap>
|
||||||
#include <QTemporaryFile>
|
|
||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
|
@ -143,6 +143,7 @@ void ForgeXzDownload::downloadReadyRead()
|
|||||||
#include "xz.h"
|
#include "xz.h"
|
||||||
#include "unpack200.h"
|
#include "unpack200.h"
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
const size_t buffer_size = 8196;
|
const size_t buffer_size = 8196;
|
||||||
|
|
||||||
@ -275,7 +276,14 @@ void ForgeXzDownload::decompressAndInstall()
|
|||||||
failAndTryNextMirror();
|
failAndTryNextMirror();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
FILE * file_in = fdopen(handle_in,"r");
|
int handle_in_dup = dup (handle_in);
|
||||||
|
if(handle_in_dup == -1)
|
||||||
|
{
|
||||||
|
qCritical() << "Error reopening " << pack200_file.fileName();
|
||||||
|
failAndTryNextMirror();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
FILE *file_in = fdopen (handle_in_dup, "rb");
|
||||||
if(!file_in)
|
if(!file_in)
|
||||||
{
|
{
|
||||||
qCritical() << "Error reopening " << pack200_file.fileName();
|
qCritical() << "Error reopening " << pack200_file.fileName();
|
||||||
@ -296,7 +304,14 @@ void ForgeXzDownload::decompressAndInstall()
|
|||||||
failAndTryNextMirror();
|
failAndTryNextMirror();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
FILE * file_out = fdopen(handle_out,"w");
|
int handle_out_dup = dup (handle_out);
|
||||||
|
if(handle_out_dup == -1)
|
||||||
|
{
|
||||||
|
qCritical() << "Error reopening " << qfile_out.fileName();
|
||||||
|
failAndTryNextMirror();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
FILE *file_out = fdopen (handle_out_dup, "wb");
|
||||||
if(!file_out)
|
if(!file_out)
|
||||||
{
|
{
|
||||||
qCritical() << "Error opening " << qfile_out.fileName();
|
qCritical() << "Error opening " << qfile_out.fileName();
|
||||||
@ -305,6 +320,7 @@ void ForgeXzDownload::decompressAndInstall()
|
|||||||
}
|
}
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
// NOTE: this takes ownership of both FILE pointers. That's why we duplicate them above.
|
||||||
unpack_200(file_in, file_out);
|
unpack_200(file_in, file_out);
|
||||||
}
|
}
|
||||||
catch (std::runtime_error &err)
|
catch (std::runtime_error &err)
|
||||||
|
@ -182,8 +182,11 @@ void CacheDownload::downloadReadyRead()
|
|||||||
{
|
{
|
||||||
qCritical() << "Failed writing into " + m_target_path;
|
qCritical() << "Failed writing into " + m_target_path;
|
||||||
m_status = Job_Failed;
|
m_status = Job_Failed;
|
||||||
m_reply->abort();
|
m_output_file->cancelWriting();
|
||||||
|
m_output_file.reset();
|
||||||
emit failed(m_index_within_job);
|
emit failed(m_index_within_job);
|
||||||
|
wroteAnyData = false;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
wroteAnyData = true;
|
wroteAnyData = true;
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,6 @@
|
|||||||
|
|
||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
#include <QTemporaryFile>
|
|
||||||
#include <QDateTime>
|
#include <QDateTime>
|
||||||
#include <QCryptographicHash>
|
#include <QCryptographicHash>
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ enum JobStatus
|
|||||||
};
|
};
|
||||||
|
|
||||||
typedef std::shared_ptr<class NetAction> NetActionPtr;
|
typedef std::shared_ptr<class NetAction> NetActionPtr;
|
||||||
class MULTIMC_LOGIC_EXPORT NetAction : public QObject, public std::enable_shared_from_this<NetAction>
|
class MULTIMC_LOGIC_EXPORT NetAction : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
protected:
|
protected:
|
||||||
@ -54,10 +54,6 @@ public:
|
|||||||
{
|
{
|
||||||
return m_failures;
|
return m_failures;
|
||||||
}
|
}
|
||||||
NetActionPtr getSharedPtr()
|
|
||||||
{
|
|
||||||
return shared_from_this();
|
|
||||||
}
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/// the network reply
|
/// the network reply
|
||||||
|
Loading…
x
Reference in New Issue
Block a user