diff options
author | Arttu Tarkiainen <arttu.tarkiainen@qt.io> | 2021-11-02 17:12:05 +0200 |
---|---|---|
committer | Arttu Tarkiainen <arttu.tarkiainen@qt.io> | 2021-11-03 08:05:27 +0000 |
commit | d02dcbd47530ce7415668ba35a2f378bf12aef15 (patch) | |
tree | 4c1afdd763764fc275d680c7a5060a34d62cd6a7 /src/libs/installer | |
parent | 6cd1ff494d4d7aadc12204789407679aa065b4a6 (diff) |
Libarchive: Fix extracting hard links pointing to files in archive
Since we already adjust the output path for archive entries, libarchive
would fail with the error string "Hard-link target '...' does not exist"
for hard links referring to extracted files. Fix by also adjusting the
hard link target paths.
Task-number: QTIFW-2403
Change-Id: I8f78117c5b0707a70c76433ca1c1483ea49b432b
Reviewed-by: Katja Marttila <katja.marttila@qt.io>
Diffstat (limited to 'src/libs/installer')
-rw-r--r-- | src/libs/installer/libarchivearchive.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/libs/installer/libarchivearchive.cpp b/src/libs/installer/libarchivearchive.cpp index 46200560b..d3a79bd40 100644 --- a/src/libs/installer/libarchivearchive.cpp +++ b/src/libs/installer/libarchivearchive.cpp @@ -123,6 +123,12 @@ void ExtractWorker::extract(const QString &dirPath, const quint64 totalFiles) const QString outputPath = dirPath + QDir::separator() + QString::fromLocal8Bit(current); archive_entry_set_pathname(entry, outputPath.toLocal8Bit()); + const char *hardlink = archive_entry_hardlink(entry); + if (hardlink) { + const QString hardLinkPath = dirPath + QDir::separator() + QString::fromLocal8Bit(hardlink); + archive_entry_set_hardlink(entry, hardLinkPath.toLocal8Bit()); + } + emit currentEntryChanged(outputPath); if (!writeEntry(reader.get(), writer.get(), entry)) return; @@ -440,6 +446,12 @@ bool LibArchiveArchive::extract(const QString &dirPath, const quint64 totalFiles const QString outputPath = dirPath + QDir::separator() + QString::fromLocal8Bit(current); archive_entry_set_pathname(entry, outputPath.toLocal8Bit()); + const char *hardlink = archive_entry_hardlink(entry); + if (hardlink) { + const QString hardLinkPath = dirPath + QDir::separator() + QString::fromLocal8Bit(hardlink); + archive_entry_set_hardlink(entry, hardLinkPath.toLocal8Bit()); + } + emit currentEntryChanged(outputPath); if (!writeEntry(reader.get(), writer.get(), entry)) throw Error(errorString()); // appropriate error string set in writeEntry() |