Bug 686061 - does not extract hardlinks from a tarball
does not extract hardlinks from a tarball
Status: RESOLVED FIXED
Product: file-roller
Classification: Applications
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: Paolo Bacchilega
file-roller-maint
:
Depends on:
Blocks:
  Show dependency tree
 
Reported: 2012-10-12 23:05 UTC by Olivier Blin
Modified: 2012-10-13 14:10 UTC (History)
1 user (show)

See Also:
GNOME target: ---
GNOME version: ---


Attachments

Description Olivier Blin 2012-10-12 23:05:50 UTC
file-roller 3.6.0 does not extract hardlinks from a tarball.

It only extracts one of the hardlinked files, and silently skips other hardlinks from the archive.

Prepare an archive with hardlinks:
$ mkdir file-roller-archive
$ touch file-roller-archive/a
$ ln file-roller-archive/a file-roller-archive/b
$ ls -lh file-roller-archive 
total 0
-rw-r--r-- 2 blino blino 0 Oct 13 00:56 a
-rw-r--r-- 2 blino blino 0 Oct 13 00:56 b
$ tar cvvf file-roller-archive.tar file-roller-archive/
drwxr-xr-x blino/blino       0 2012-10-13 00:56 file-roller-archive/
-rw-r--r-- blino/blino       0 2012-10-13 00:56 file-roller-archive/b
hrw-r--r-- blino/blino       0 2012-10-13 00:56 file-roller-archive/a link to file-roller-archive/b

Now extract the archive with file-roller, keeping directory structure.
$ rm -rf file-roller-archive
$ file-roller file-roller-archive.tar
$ ls -lh file-roller-archive
total 0
-rw-r--r-- 1 blino blino 0 Oct 13 00:56 b

The "a" hardlinked file is missing.

The tar utility correctly extracts both hardlinked files:
$ rm -rf file-roller-archive
$ tar xvvf file-roller-archive.tar 
drwxr-xr-x blino/blino       0 2012-10-13 00:56 file-roller-archive/
-rw-r--r-- blino/blino       0 2012-10-13 00:56 file-roller-archive/b
hrw-r--r-- blino/blino       0 2012-10-13 00:56 file-roller-archive/a link to file-roller-archive/b
$ ls -lh file-roller-archive 
total 0
-rw-r--r-- 2 blino blino 0 Oct 13 00:56 a
-rw-r--r-- 2 blino blino 0 Oct 13 00:56 b
Comment 1 Olivier Blin 2012-10-12 23:31:28 UTC
This seems to happen in the libarchive code, using libarchive-3.0.4
Comment 2 Paolo Bacchilega 2012-10-13 11:27:19 UTC
This problem has been fixed in the development version. The fix will be available in the next major software release. Thank you for your bug report.
Comment 3 Olivier Blin 2012-10-13 14:10:12 UTC
Confirmed it works with your 3 last patches, both with my simplified test case and with a more complicated archive having a file hardlinked 4 times (p4v.tgz from perforce.com).
Thank you very much for fixing it so fast!

Note You need to log in before you can comment on or make changes to this bug.