Extraction fails for .tar.gz archive

Bug #114784 reported by Chandru
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
KDE Utilities
Fix Released
Medium
kdeutils (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

Binary package hint: ark

Package Version: 4:3.5.6-0ubuntu2

When I open the archive(demo.tar.gz) attached here, with ark and try to extract the contents I get two different behaviors based on how I perform it.

1. If I do not select any of the files inside the archive and click on extract button on the toolbar to extract, it does not give any problem.
2. However, if I select the top-most directory(demo) and click on extract button on the toolbar to extract, it gives an error message but the files are extracted properly. I've attached a screenshot of the error displayed.

Revision history for this message
Chandru (chandru-in-deactivatedaccount) wrote :
Revision history for this message
Chandru (chandru-in-deactivatedaccount) wrote :
Revision history for this message
Chandru (chandru-in-deactivatedaccount) wrote : Re: Found the fix

I've found where the problem lies. The problem is caused due to the fact that the tar program reports error when both a directory and its files/subdirs are provided in the list of files to be extracted.

Consider the following directory structure inside the archive (test.tar.gz).

test
|
|-demo
  |
  |-index.html

Now executing the following command,

tar -xzf test.tar.gz test test/demo test/demo/index.html

would generate the following error,

tar: test/demo: Not found in archive
tar: test/demo/index.html: Not found in archive
tar: Error exit delayed from previous errors

This is exactly the problem generated by ark. There is no necessity to include the children of the directory selected to be included in the list of files to be extracted, as the contents of the directories specified get extracted by default.

tar -xzf test.tar.gz test

would be sufficient. However, this is not true for other archive programs like zip.

The problem at hand:

In the source code of ark, the "FileListView" class (inside filelistview.cpp) contains the function "selectedFilenames()" which adds the children of the selected directory also to the list of selected files. This when used by "TarArch::unarchFileInternal()", causes the problem.

Solution:

This problem can be solved, if a piece of code is incorporated into "FileListView::selectedFilenames()" to check the mime-type of the currently opened archive and if it is a tar type, the children of the selected directories should not be included in the list of selected files.

I hope this understanding would greatly help the developers in fixing the problem soon. I'm very sorry that I'm not able to solve the problem myself as I don't have the time to do fix it in the code. I've dared to change the status of the bug to "confirmed".

Revision history for this message
Chandru (chandru-in-deactivatedaccount) wrote :

I'm sure it is a problem and it can be fixed easily!

Changed in kdeutils:
status: Unconfirmed → Confirmed
Revision history for this message
Chandru (chandru-in-deactivatedaccount) wrote :

Another situation which also needs to be handled is when the user himself has selected a directory and a file/directory directly/indirectly within it.

Revision history for this message
Sarah Kowalik (hobbsee-deactivatedaccount) wrote :

this needs reporting to bugs.kde.org

Revision history for this message
Chandru (chandru-in-deactivatedaccount) wrote :
Changed in kdeutils:
status: Unknown → Confirmed
Changed in kdeutils:
status: Confirmed → Triaged
Revision history for this message
Sayak Banerjee (sayakb-deactivatedaccount) wrote :

I can still reproduce it on Ark (2.10.999) 4:4.1.2-0ubuntu5

Revision history for this message
Harald Sitter (apachelogger) wrote :

Sayak, I can't. What are you doing exactly?

Revision history for this message
Sayak Banerjee (sayakb-deactivatedaccount) wrote :

Seems to be working fine now! Sorry for the late reply :)

Revision history for this message
Jonathan Thomas (echidnaman) wrote :

Reported fixed.

Changed in kdeutils:
status: Triaged → Fix Released
Changed in kdeutils:
status: Confirmed → Fix Released
Changed in kdeutils:
importance: Unknown → Medium
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.