Subject: bug#19616: [Bug-tar] dist tarball contains hardlinks

From: Dimitrios Apostolou <[email-masked]>
Date: Fri, 23 Jan 2015 15:44:26 +0100 (CET)

On Sun, 18 Jan 2015, Paul Eggert wrote:

> Dimitrios Apostolou wrote:
>> But when the tarball is extracted, two files with same inode are created, 
>> which
>> is kind of unexpected behaviour - at least for me
>
> Other utilities have similar behavior (e.g., ls, cp, du), in that they 
> pretend the symlink isn't there and behave as if the pointed-to inode is 
> there directly.  Tar's current behavior is compatible with these other 
> utilities, whereas its old behavior was incompatible.

Well out of the utilities you mentioned, only "cp" actually writes 
something, so it's related to the issue with tar. So I tried the behaviour 
of --dereference in cp:

$ touch blah
$ ln -s blah link_to_blah
$ cp --dereference link_to_blah blah2

The result is that "blah" and "blah2" have different inode! So 
--dereference causes the symlink to be dereferenced to a separate file, 
*not* to a hardlink of the source.

But in tar, --dereference causes a symlink to be dereferenced as a 
hardlink to the source file. So how is their behaviour consistent? BTW, my 
version of "cp" is:

$ cp --version
cp (GNU coreutils) 8.21

Thanks,
Dimitris