KTar::openArchive: Don't assert if file has two root dirs
ClosedPublic

Authored by aacid on Jul 28 2019, 3:30 PM.

Details

Summary

I was wondering if adding this check in KArchive::setRootDir
instead but i ended doing it here since i think an assert in setRootDir is
valid for when C++ users of that class do it wrong.

Diff Detail

Repository
R243 KArchive
Branch
arcpatch-D22786
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 14547
Build 14565: arc lint + arc unit
aacid created this revision.Jul 28 2019, 3:30 PM
Restricted Application added a project: Frameworks. · View Herald TranscriptJul 28 2019, 3:30 PM
Restricted Application added a subscriber: kde-frameworks-devel. · View Herald Transcript
aacid requested review of this revision.Jul 28 2019, 3:30 PM
apol accepted this revision.Jul 28 2019, 10:27 PM
This revision is now accepted and ready to land.Jul 28 2019, 10:27 PM
dfaure requested changes to this revision.Jul 29 2019, 7:54 AM

Let's be tolerant and skip the second root dir (with a warning, but without return false). This would be more in line with what we do in case of duplicated subdirs, and with what tar does.

Testcase:

mkdir /tmp/tar
touch /tmp/tar/file
cd /tmp/tar
tar cf /tmp/tar.tar.gz . .
tar tf /tmp/tar.tar.gz
./
./file
./tar.tar.gz
./
./file
./tar.tar.gz
(back to karchive builddir)
bin/ktartest /tmp/tar.tar.gz
-> ASSERT
This revision now requires changes to proceed.Jul 29 2019, 7:54 AM
aacid updated this revision to Diff 62749.Jul 29 2019, 5:05 PM

don't return false on the "two roots scenario" as suggested by dfaure

dfaure accepted this revision.Jul 29 2019, 8:07 PM
This revision is now accepted and ready to land.Jul 29 2019, 8:07 PM
aacid closed this revision.Jul 29 2019, 8:11 PM