bug-tar
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug-tar] Handling of hardlinked files in special cases


From: Bodo Eggert
Subject: [Bug-tar] Handling of hardlinked files in special cases
Date: Fri, 21 Nov 2003 16:20:28 +0100 (CET)

If you extract a tarball containing two or more hardlinked files,
the second file will (off cause) be hardlinked to the first one.
While this is usurally the right thing to do, it fails sometimes:

1) If you add new mountpoints, tar fails while creating
   cross-device-links.
2) If you skip extracting the first file, e.g. by using -k or by
   extracting only a subset of the archive, there is either no file to
   link to, or the file is probably the wrong file to link to.

I don't think these cases can be handled while extracting, unless
hardlinked files are treated specially while creating the archive:

Basically, you would have to keep a list of hardlinked files untill
all links are found or untill the last non-hardlinked file has been
found. Since the unpacker needs to know the name of all symlinks
to decide wether to unpack the file, this information must be
written before the actual file is packed (unless the file is small).

I don't think keeping the list will be a big problem, since the
--check-links option allready does link-counting, but changing the order
of the hardlinks and the files will probably be incompatible to older
implementations.

If this work is done, you can easily add the nescensary sanity checks:
If the file that would be linked to differs in size/mtime from the
archived object, the stored object should be extracted instead.
If a cross-device-link fails, the extracted file should be copied (check
for interbediate modifications) and considered to be an alternative link source.

You can also make the hardlink-handling configurable, e.g.
--hardlinks=copy|smart|traditional
-- 
       ¤ Bill of Spammer-Rights ¤
1. We have the right to assassinate you.
2. You have the right to be assassinated.
3. You have the right to resist, but it is futile.






reply via email to

[Prev in Thread] Current Thread [Next in Thread]