Re: How to restore files without deleting existing
On Sun, Oct 03, 2004 at 07:57:33PM -0700, Jeff Chimene wrote:
> --- Paul E Condon <email@example.com> wrote:
> > On Sun, Oct 03, 2004 at 07:33:04PM -0700, Jeff
> > Chimene wrote:
> > >
> > > --- Rajesh Menon <firstname.lastname@example.org> wrote:
> > >
> > > > As far as I know, if you operate on the symlink,
> > you
> > > > are operating on
> > > > the files/dir that it points to. Unlike hard
> > links,
> > > > which are actual
> > > > copies of the link pointed to.
> > > > And if I recall right, tar's behaviour, by
> > default,
> > > > is to over-write the
> > > > destination.
> > > >
> > > > tar -xzf archive.tar.gz => it's going to create
> > > > (overwrite) a folder 'source' and dump the
> > output in
> > > > there.
> > >
> > > Thank you for the reply! I think that I clobbered
> > the
> > > symlink - i.e. the original files are in the
> > original
> > > directory. The symlink got replaced by the actual
> > > directory.
> > >
> > > Is there a way for tar to follow the symlink, or
> > am I
> > > supposed to be writing into the linked directory?
> > >
> > > Cheers,
> > > Jeff Chimene
> > >
> > In my test, I used -h option only for creating .tgz
> > file
> > My untar did -not- have -h option and yet the files
> > that
> > were in the .tgz file were placed by following the
> > symlink.
> > I appears that you only need -h when you are
> > creating.
> > So, this is not likely explanation of what happened
> > to you.
> > But, again, maybe Red Hat tar behaves differently.
> bash-2.05b$ tar --version
> tar (GNU tar) 1.13.25
> Copyright (C) 2001 Free Software Foundation, Inc.
> It's got something to do with following symlinks in a
> secure way. I found a thread that seemed to indicate
> that this behavior is more secure than previous
> symlink handling. I didn't follow the thread closely,
> but I think that's the gist of this class of behavior.
> Fortunately, I have the original files :)
> So, I will modify my restore process to write to the
> actual directory, rather than the symlink. That should
> yield the desired behavior.
my version of tar is 1.13.93
but the last mention symlink in the changelog of tar
is in sept 2001 at version 1.13.23, so our two versions
should behave the same.
it does _not_ clobber the symlink during extract.
if the symlink is there, it uses it and puts the files where you
originally expected it to put them, namely in the target of the
if there is not a 'source/' entry in it working directory, either
symlink or real directory, it creates a real directory and loads the
files into it.
I think there is some other explanation for what happened, but just
not using symlinks is surely OK. Only it may not correct whatever
actually went amiss. And that whatever is still there, waiting.
Paul E Condon