Paul Eggert <[email protected]> wrote:

> On 11/02/2012 09:29 AM, Joerg Schilling wrote:
> > this should not happen when the file has a linkcount == 1
>
> I don't see why not.  There are two instances of the file
> in the archive, at the user's request, and they are the
> same file, so one should be a hard link to the other.
>
> Solaris 'tar' behaves differently.  If you do this:
>
>   $ touch x
>   $ tar cf f x x
>
> it creates an archive with two copies of 'x'.  If you do this
> instead:
>
>   $ touch x
>   $ ln x y
>   $ tar cf f x x
>
> it creates an archive with one copy, and a hard link, which
> is what GNU tar does in both cases.  GNU tar is more consistent,
> since it behaves the same regardless of whether the file happens
> to have hard links somewhere else in the file system (something
> that should not affect what archive is produced).

It is questionable whether this behavior could be called "more consistent".

UNIX has rules and the indication for a hard link is a link count > 1.

Jörg

-- 
 EMail:[email protected] (home) Jörg Schilling D-13353 Berlin
       [email protected]                (uni)  
       [email protected] (work) Blog: 
http://schily.blogspot.com/
 URL:  http://cdrecord.berlios.de/private/ ftp://ftp.berlios.de/pub/schily

Reply via email to