tar: untaring with --recursive-unlink ends with an empty directory

Bug #1357345 reported by Hibou57 (Yannick Duchêne)
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
tar (Ubuntu)
New
Undecided
Unassigned

Bug Description

Using tar version 1.26-4ubuntu1 from Ubuntu 12.04 (I'm submitting this case here, as I can't tell if it's specific to the tar shipped with Ubuntu or a bug with all tar, and this concerns Ubuntu base packages anyway).

Using the attached archive file, running this:

/bin/tar --extract --auto-compress --exclude-backups --exclude-caches --exclude-vcs --preserve-permissions --recursive-unlink --totals --unlink-first --verbose --file Sphinx.tar.xz; ls Sphinx

… I get an empty directory, although the output says it extracted many things.

This seems to be related to a buggy `--recursive-unlink` option, as this one works:

/bin/tar --extract --auto-compress --exclude-backups --exclude-caches --exclude-vcs --preserve-permissions --totals --unlink-first --verbose --file Sphinx.tar.xz; ls Sphinx

… the directory is not empty any‑more.

I get this unexpected behaviour with this archive only, not with others.

My guess is that it's due to the order in which the entries appears in the tar file. Indeed, the Sphinx top level directory is listed last, and its content before it, so tar extract its content then delete all the directory to recreate the directory, emptied.

I can't believe this is the expected behaviour.

Revision history for this message
Hibou57 (Yannick Duchêne) (yannick-duchene) wrote :
Revision history for this message
Hibou57 (Yannick Duchêne) (yannick-duchene) wrote :

In case someone is interested in this bug, what I remember I noticed later, is that `tar` extract a directory, then delete it, then try to add files in the just deleted directory (which turns to be wrong, obviously), then sometime recreate the directory, which ends to be empty.

Someone should care, as `tar` is a core functionality.

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.