[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
tar -x handling of symlinked directories
From: |
L. Peter Deutsch |
Subject: |
tar -x handling of symlinked directories |
Date: |
Fri, 14 Feb 2003 23:26:12 -0800 |
Environment: Red Hat Linux 7.3, tar (GNU tar) 1.13.25
Consider the following sequence of commands:
mkdir this
mkdir that
cat >this/afile
^D
tar -cf x.tar this
rm -r this
ln -s that this
tar -xf x.tar
Rather than following the symlink and creating this/afile (which is actually
that/afile), tar -x removes the symlink and create a new directory. This
has very bad consequences in environments where (for example) /usr/local is
a symlink and tar -x is used for installing local software.
The man page for tar says nothing about this. The info page for "Options
Controlling the Overwriting of Existing File" does say that
If the existing file is a symbolic link, it is removed, not
followed.
The info page even gives the example of usr/local being a link to
usr/local2, but it assumes that usr/local in the .tar file is also a link:
the case I am writing about is the situation where the existing directory is
a link, but the directory in the .tar file is not.
I don't want to argue about what the default behavior of tar -x should be --
that is, about whether the current behavior is a bug -- but there definitely
should be an option to follow rather than replacing symlinks when extracting
from an archive. Perhaps the existing -h/--dereference option, currently
recognized only when dumping, should also be recognized when loading and
should mean "don't replace symlinks: replace the files they point to." Or
perhaps there should be a new option that does this only for directories.
One way or another, though, this functionality should definitely be
available.
Thanks -
L. Peter Deutsch | Aladdin Enterprises | 203 Santa Margarita Ave.
address@hidden | http://www.aladdin.com | Menlo Park, CA 94025
No government censorship of software! Oppose the CBDTPA! www.eff.org
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- tar -x handling of symlinked directories,
L. Peter Deutsch <=