I'm not sure how hard links come into this discussion. The last example I provided has no hard links.
I realize that if there is a hard link to foo, then a hard link appears for the symlink. Are you saying that tar now behaves the same, regardless of whether there is a hard link to foo? So dereferencing a symlink will always produce a hard link in the archive? Michael On Thu, Jan 6, 2011 at 9:28 AM, Paul Eggert <[email protected]> wrote: > On 01/06/2011 06:28 AM, Michael Lawrence wrote: > > The above looks broken to me. The symlink becomes a hard link in the > archive. > > That's because, if you follow the symlink (which -h is supposed > to do), the the pointed-at file *is* a hard link. The same thing > happens with ls's --dereference option. For example: > > $ touch foo > $ ln foo foo-hard > $ ln -s foo foo-soft > $ ls -il > total 0 > 2755582 -rw-r--r-- 2 eggert eggert 0 2011-01-06 09:21 foo > 2755582 -rw-r--r-- 2 eggert eggert 0 2011-01-06 09:21 foo-hard > 2755583 lrwxrwxrwx 1 eggert eggert 3 2011-01-06 09:21 foo-soft -> foo > $ ls -ilL > total 0 > 2755582 -rw-r--r-- 2 eggert eggert 0 2011-01-06 09:21 foo > 2755582 -rw-r--r-- 2 eggert eggert 0 2011-01-06 09:21 foo-hard > 2755582 -rw-r--r-- 2 eggert eggert 0 2011-01-06 09:21 foo-soft > > tar -h is consistent with ls -L here: > > $ tar cf - * | tar tvf - > -rw-r--r-- eggert/eggert 0 2011-01-06 09:21 foo > hrw-r--r-- eggert/eggert 0 2011-01-06 09:21 foo-hard link to foo > lrwxrwxrwx eggert/eggert 0 2011-01-06 09:21 foo-soft -> foo > $ tar chf - * | tar tvf - > -rw-r--r-- eggert/eggert 0 2011-01-06 09:21 foo > hrw-r--r-- eggert/eggert 0 2011-01-06 09:21 foo-hard link to foo > hrw-r--r-- eggert/eggert 0 2011-01-06 09:21 foo-soft link to foo > > and this is true for both older tar (before 1.24) and newer tar. > If this behavior is "broken", then older GNU tar, Solaris tar, etc., are > also "broken", and "ls" is also "broken". But they're not "broken": > they're following the symbolic link, which is what they're being asked > to do. >
