bug-tar
[Top][All Lists]
Advanced

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

[Bug-tar] tar behaviour concerning overwriting of symlinks to target dir


From: Matthias Koenig
Subject: [Bug-tar] tar behaviour concerning overwriting of symlinks to target directories
Date: Mon, 16 Apr 2007 12:35:30 +0200
User-agent: Gnus/5.110006 (No Gnus v0.6) Emacs/21.3 (gnu/linux)

Hi,

consider the following testcase:

# mkdir a
# touch a/foobar
# tar cvf a.tar a/
a/
a/foobar
# rm -rf a/

Now create a directory b and link a to b

mkdir b
ln -s b a

ls -l
lrwxrwxrwx 1 mkoenig suse     1 2007-04-16 12:08 a -> b
-rw-r--r-- 1 mkoenig suse 10240 2007-04-16 12:07 a.tar
drwxr-xr-x 2 mkoenig suse  4096 2007-04-16 12:08 b

Now with newer tar (tested with 1.15.1 and 1.16.1), when
extracting the archive, the content gets extracted into
the directory b.

# tar xvf a.tar
a/
a/foobar

# ls -l
lrwxrwxrwx  1 mkoenig suse     1 2007-04-16 12:19 a -> b/
-rw-r--r--  1 mkoenig suse 10240 2007-04-16 12:18 a.tar
drwxr-xr-x  2 mkoenig suse  4096 2007-04-16 12:20 b/

If one wants explicitly to tell tar to overwrite the link to
the target directory, this can be done with --no-overwrite
(--no-overwrite-dir or --unlink-first work also)

# tar xvf a.tar --no-overwrite
a/
a/foobar

# ls -l
drwxr-xr-x  2 mkoenig suse  4096 2007-04-16 12:18 a/
-rw-r--r--  1 mkoenig suse 10240 2007-04-16 12:18 a.tar
drwxr-xr-x  2 mkoenig suse  4096 2007-04-16 12:20 b/

Is this behaviour correct? The documentation isn't that clear about
overwriting of links to a target directory. Though I think the default
behaviour is reasonable, I am not sure why the option --no-overwrite
is needed to tell tar to overwrite the link.

Earlier versions of tar (tested with 1.13.25) did overwrite
the link without any option.

Thanks,
Matthias





reply via email to

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