help-gnu-utils
[Top][All Lists]
Advanced

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

Re: tar: Member name contains `..'


From: Doofus
Subject: Re: tar: Member name contains `..'
Date: Mon, 01 Nov 2004 03:14:01 GMT

bjb@istop.com wrote...
> On Wed, Oct 27, 2004 at 05:03:11AM +0000, Doofus wrote:
> > tar (GNU tar) 1.13.25       
> > SuSE Linux 8.2
> > 
> > I'm trying to extract a directory one level up from the directory the 
> > archive was created in.
> > 
> > For each file in that upper-level directory, I get a 
> > 
> >     Member name contains `..'
> > 
> > message and no extraction.  Doesn't matter if I extract to stdout, 
> > whether I'm root, or what.  I've also tried '--strip-level=1' but my 
> > version of tar doesn't recognize that option, and I'm uncertain that 
> > it would resolve this anyway.
> > 
> > I'm not trying to do anything funny.  I'm just trying to restore some 
> > files.  So far, I haven't found any reference to '..' in 'info tar' 
> > yet, nor the man page, nor on-line.  I'm still looking, of course.
> > 
> > Any help appreciated.
> 
> So, the way I understand it is:
> you have a tar file of stuff like
> 
> path/to/file1
> path/to/file2
> path/to/another/file3
> 
> (You can tell what's in the tarfile with the -t command:
> tar -tvf tarfile)
> 
> You (and the tarfile) are in directory "another" and you'd like
> to extract file1 and file2 to directory "to".
> 
> If that is the case, then use the -C option:
> 
> tar -C ../../.. -xf tarfile.tar path/to/file1 path/to/file2
> 
> Or you can:
> 
> cd ../../..
> tar -xf path/to/another/tarfile.tar path/to/file1 path/to/file2

I apologize for not being clearer.  Here's the situation:

<my home dir>
        <foo>
        <bar>

<foo> and <bar> are peer directory nodes off of <my home dir>.  The 
archive was created within <bar>, and -- FROM WITHIN <bar> -- adds 
files in <foo> to the archive in <bar>:

cd /users/my home dir/bar
tar -cf *.c *.h ../foo/*.c ../foo/*.h

So now, regardless of what I do, any attempt to extract the files 
from <foo> gets me the 'fore-mentioned error:

../foo/file.c: Member name contains '..'

and it isn't extracted.  Permissions are correct, etc. ; tar simply 
rejects the extraction a priori if the name contains a ".."

I'm thinking I'll just get the sources and 'fix' the problem that 
way, since I truly do need the files in the archive.  I'm very 
surprised there isn't a way to force the extraction (permissions 
allowing of course).


reply via email to

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