diff options
author | Arttu Tarkiainen <arttu.tarkiainen@qt.io> | 2021-10-25 15:28:09 +0300 |
---|---|---|
committer | Arttu Tarkiainen <arttu.tarkiainen@qt.io> | 2021-10-26 15:29:27 +0300 |
commit | 9cf92b4cd273be55c056253b8e4a3a57e13195a8 (patch) | |
tree | ff0d4b9ad85fb5b5dea96045fb57ecf40a3ce0b2 /tests | |
parent | 4066fbebcabbdf591c2fc525343f8f78486457d2 (diff) |
Add support for seeking files handled with libarchive
This fixes losing executable bits of files in Zip archives when
extracted. Zip archives store file metadata in two ways, partial
metadata per-entry and full metadata at the end of archive. IFW's read
implementation previously did only streaming without support for seeking
archives, which is required to obtain full metadata - meaning the
partial metadata was used instead by libarchive's Zip reader. The
extracted entries between the two metadata types are not consistent.
This change also enables usage of archive formats that cannot be
accurately handled with a streaming model, like 7zip which needs to read
key data from the end of the file before reading file data from the
beginning.
Task-number: QTIFW-2372
Change-Id: Ie4ed33040fc52de073546e46d9da726816f47a81
Reviewed-by: Katja Marttila <katja.marttila@qt.io>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/installer/libarchivearchive/tst_libarchivearchive.cpp | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/tests/auto/installer/libarchivearchive/tst_libarchivearchive.cpp b/tests/auto/installer/libarchivearchive/tst_libarchivearchive.cpp index f12de22a4..8034f9556 100644 --- a/tests/auto/installer/libarchivearchive/tst_libarchivearchive.cpp +++ b/tests/auto/installer/libarchivearchive/tst_libarchivearchive.cpp @@ -44,6 +44,7 @@ private slots: void initTestCase() { m_file.path = "valid"; + m_file.permissions_mode = 0666; m_file.compressedSize = 0; // unused m_file.uncompressedSize = 5242880; m_file.isDirectory = false; @@ -79,7 +80,7 @@ private slots: QVector<ArchiveEntry> files = archive.list(); QCOMPARE(files.count(), 1); - QVERIFY(entriesMatch(files.first(), m_file)); + QCOMPARE(files.first(), m_file); } void testCreateArchive_data() @@ -167,15 +168,6 @@ private: QTest::newRow("xz compressed tar archive") << ".tar.xz"; } - bool entriesMatch(const ArchiveEntry &lhs, const ArchiveEntry &rhs) - { - return lhs.path == rhs.path - && lhs.utcTime == rhs.utcTime - && lhs.isDirectory == rhs.isDirectory - && lhs.compressedSize == rhs.compressedSize - && lhs.uncompressedSize == rhs.uncompressedSize; - } - QString tempSourceFile(const QByteArray &data, const QString &templateName = QString()) { QTemporaryFile source; |