https://bugs.kde.org/show_bug.cgi?id=524159
Bug ID: 524159
Summary: Extraction strips ALL occurrences of the root node
from entry paths, corrupting nested directory names
Classification: Applications
Product: ark
Version First unspecified
Reported In:
Platform: RedHat Enterprise Linux
OS: Linux
Status: REPORTED
Severity: major
Priority: NOR
Component: general
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected]
Target Milestone: ---
SUMMARY
CliInterface::moveDroppedFilesToDest() in kerfuffle/cliinterface.cpp computes
the
relative path with:
QFileInfo relEntry(file->fullPath().remove(file->rootNode));
QString::remove(const QString&) removes *every* occurrence of the substring,
not
just the leading one. If the root node name also appears inside nested paths,
those nested path components are silently mangled.
For comparison, the other plugins do it correctly:
- plugins/libzip/libzipplugin.cpp: truncatedEntry.remove(0,
rootNode.size());
- plugins/libarchive/libarchiveplugin.cpp:
entryName.remove(entryName.indexOf(rootNode), rootNode.size());
STEPS TO REPRODUCE
1. mkdir -p x64/runtimes/linux-x64/native
2. touch x64/runtimes/linux-x64/native/lib.so
3. zip -r t.zip x64
4. Open t.zip in Ark, drag the "x64" folder into Dolphin.
OBSERVED RESULT
runtimes/linux-native/lib.so
plus an empty leftover directory "runtimes/linux-"
(both occurrences of "x64/" were removed).
EXPECTED RESULT
runtimes/linux-x64/native/lib.so
(only the leading root node "x64/" removed).
SOFTWARE/OS VERSIONS
Ark 23.08.5, RHEL. The same code is still present in master, so this is not
fixed in current versions.
ADDITIONAL INFORMATION
Real-world impact: a .NET application archive lays native libraries out as
runtime-identifier directories (runtimes/linux-x64/native/*.so). Extracting
such
an archive under a top-level "x64" folder silently breaks every RID directory
containing "x64", and the application then fails at startup with
DllNotFoundException. The corruption is silent - no warning or error is shown.
Suggested fix: strip the prefix instead of removing all occurrences, e.g.
QString relPath = file->fullPath();
relPath.remove(0, file->rootNode.size());
See also: bug 369535 - the same class of bug (rootNode substring removal
corrupting path components) was fixed back in 16.08.2, but only in
plugins/libarchive/libarchiveplugin.cpp. kerfuffle/cliinterface.cpp was left
with the original remove-all-occurrences call and is still affected in master.
--
You are receiving this mail because:
You are watching all bug changes.