bug-tar
[Top][All Lists]
Advanced

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

Re: [Bug-tar] dereferencing broken since 1.24?


From: Michael Lawrence
Subject: Re: [Bug-tar] dereferencing broken since 1.24?
Date: Thu, 6 Jan 2011 06:28:01 -0800


On Wed, Jan 5, 2011 at 3:41 PM, Paul Eggert <address@hidden> wrote:
On 01/05/11 13:58, Michael Lawrence wrote:

> If I understand you correctly, with -h there should be no links
> within the archive, i.e., there are two copies of foo in the
> archive. This is not how tar >= 1.24 behaves.

I'm afraid it's not that simple.  -h prevents *soft* links in the
archive, but it doesn't prevent *hard* links:

 $ touch foo
 $ ln foo foo-hard
 $ ln -s foo foo-soft
 $ ls -l foo-hard foo-soft
 -rw-r--r-- 2 eggert eggert 0 Jan  5 15:02 foo-hard
 lrwxrwxrwx 1 eggert eggert 3 Jan  5 15:03 foo-soft -> foo
 $ tar chf x.tar foo-hard foo-soft
 $ tar tvf x.tar
 -rw-r--r-- eggert/eggert     0 2011-01-05 15:02 foo-hard
 hrw-r--r-- eggert/eggert     0 2011-01-05 15:02 foo-soft link to foo-hard

This behavior is the same in tar 1.22 and 1.25 (I just checked).

What's different in tar 1.24 and later, is that tar's behavior
does not change based on whether foo-hard's link count is
2 or more.  As Joerg Schilling notes, earlier versions of GNU tar
treat foo-soft differently if foo-hard's link count is 1.  However,
this was a bug in GNU tar.


It looks like I completely screwed up the initial bug report. I apologize for wasting everyone's time. Please forget everything and consider the following. I'm only talking about symlinks here, not hard links. There's a difference between tar 1.24/1.25 and 1.23:
 
$ ls -l foo bar                                       
lrwxrwxrwx 1 larman larman 3 Jan  4 15:06 bar -> foo
-rw-r--r-- 1 larman larman 0 Jan  4 15:06 foo
$ tar --version                                       
tar (GNU tar) 1.25
[clipped]
$ tar cfh foo.tar foo bar
$ tar tfv foo.tar
-rw-r--r-- larman/larman     0 2011-01-04 15:06 foo
hrw-r--r-- larman/larman     0 2011-01-04 15:06 bar link to foo

The above looks broken to me. The symlink becomes a hard link in the archive. I would have expected the following:

$ tar --version
tar (GNU tar) 1.23
$ tar cfh foo.tar foo bar                             
$ tar tfv foo.tar
-rw-r--r-- larman/larman     0 2011-01-04 15:06 foo
-rw-r--r-- larman/larman     0 2011-01-04 15:06 bar

Thanks,
Michael

As far as I can tell, this issue is irrelevant to Amanda.
The problem with Amanda that Gene Heskett is referring to
was fixed in a November 22 patch
<http://lists.gnu.org/archive/html/bug-tar/2010-11/msg00089.html>.
It may be time to distribute a new version of GNU tar, which
incorporates that patch.



reply via email to

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