Bug 309463

Summary: KTar asserts with certain files
Product: [Frameworks and Libraries] kio Reporter: András Manţia <amantia>
Component: tarAssignee: Mario Bensi <mbensi>
Status: RESOLVED FIXED    
Severity: normal CC: annma, faure
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed In: 4.9.5
Attachments: File that triggers the crash also with ktartest

Description András Manţia 2012-11-03 09:28:30 UTC
With the attached file KTar asserts with:
ASSERT: "!d->rootDir" in file /encrypted/home/andris/development/sources/kde-trunk/kdelibs/kdecore/io/karchive.cpp, line 466

The problem is that rootDir is indeed set twice.
Once in ktar.cpp line 471, the second time in line 481.

The tar is created in kdevplatform/cmake/modules/KDevPlatformMacros.cmake
with the following command:

        add_custom_command(OUTPUT ${_template}
            COMMAND tar ARGS -c -C ${CMAKE_CURRENT_SOURCE_DIR}/${_templateName}
                --exclude .kdev_ignore --exclude .svn
                -j -f ${_template} .
            DEPENDS ${_deps}
        )

(so you can see tha arguments) oassed.

Reproducible: Always

Actual Results:
Comment 1 András Manţia 2012-11-03 09:29:17 UTC
Created attachment 74953 [details]
File that triggers the crash also with ktartest
Comment 2 Anne-Marie Mahfouf 2012-12-02 20:52:25 UTC
I also hit this assert using KAppTemplate.
Comment 3 David Faure 2012-12-11 12:43:17 UTC
Git commit fff2a02946cde51702ba77c51b03e2ff1d57810f by David Faure.
Committed on 11/12/2012 at 13:42.
Pushed by dfaure into branch 'KDE/4.9'.

Skip pax extended headers, to avoid seeing "." twice.

Use the same logic to skip pax global extended headers (added by
recent commit).
FIXED-IN: 4.9.5

M  +12   -11   kdecore/io/ktar.cpp
M  +18   -0    kdecore/tests/karchivetest.cpp
M  +1    -0    kdecore/tests/karchivetest.h
A  +-    --    kdecore/tests/tar_rootdir.tar.bz2

http://commits.kde.org/kdelibs/fff2a02946cde51702ba77c51b03e2ff1d57810f
Comment 4 David Faure 2013-01-04 22:55:04 UTC
Which version of tar created the tar archive with Pax headers?
Comment 5 András Manţia 2013-01-05 08:17:06 UTC
My tar was 1.26 (same as yours). AFAIS that is used at build time to create the template archives.