Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

HELP: tar extract, but "Member name contains '..' "

1,362 views
Skip to first unread message

Doofus

unread,
Oct 27, 2004, 9:05:13 PM10/27/04
to
tar (GNU tar) 1.13.25
SuSE Linux 8.2

I'm trying to extract and restore 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.

Laurenz Albe

unread,
Oct 28, 2004, 5:10:02 AM10/28/04
to
Doofus <doo...@doofus.nodomain> wrote:
> I'm trying to extract and restore 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.

What is the command you typed to create the tar file?
What is the command you type to extract the tar file?
What is the output of 'tar -tvf <tar file>'?

Yours,
Laurenz Albe

Doofus

unread,
Oct 28, 2004, 9:17:13 PM10/28/04
to
al...@culturallNOSPAM.com wrote...

If those three questions are (a), (b), and (c), then:

First: The directory structure is

<home>
<foo>
<bar>

a) Within <bar>, the command was

tar -xcf foobar.tar * ../foo/*

b) Within <bar>, tar -xvf foobar.tar

c) Everything within <bar> extracts, everthing that was in <foo>
produces

../foo/file.n
tar: ../foo/file.n: Member name contains `..'

>
> Yours,
> Laurenz Albe
>

Doofus

unread,
Oct 28, 2004, 10:26:53 PM10/28/04
to
doo...@doofus.nodomain wrote...

> al...@culturallNOSPAM.com wrote...
> > Doofus <doo...@doofus.nodomain> wrote:
> > > I'm trying to extract and restore 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.
> >
> > What is the command you typed to create the tar file?
> > What is the command you type to extract the tar file?
> > What is the output of 'tar -tvf <tar file>'?
>
> If those three questions are (a), (b), and (c), then:
>
> First: The directory structure is
>
> <home>
> <foo>
> <bar>
>
> a) Within <bar>, the command was
>
> tar -xcf foobar.tar * ../foo/*

I'm not called doofus for nothing. The correct answer here is

tar -cvf foobar.tar * ../foo/*

Constantin Wiemer

unread,
Oct 29, 2004, 2:08:35 AM10/29/04
to

If I understand you correcly then the directory bar resides in directory
foo. If this is true why don't you do just
tar -cvf foobar.tar * bar/*
in directory foo?

Regards,

Constantin Wiemer

Doofus

unread,
Oct 29, 2004, 12:53:04 PM10/29/04
to
constant...@infineon.com wrote...

No, they're peers.

I'm failing on the extraction, not the creation, of the archive.

Michael Paoli

unread,
Nov 1, 2004, 1:21:24 AM11/1/04
to
Doofus <doo...@doofus.nodomain> wrote in message news:<MPG.1bea0fd9d...@news.verizon.net>...

> tar (GNU tar) 1.13.25
> SuSE Linux 8.2
>
> I'm trying to extract and restore 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 `..'

GNU tar tries to be relatively defensive about extracting stuff
it thinks may be particularly unexpected or problematic, most
notably absolute pathnames and references to parent directories.

The extraction solution may not be immediatley obvious (relative to
the documentation), but the same option seems useful to override the
blocking of extraction in either case.

$ tar -cf tar ../foo
tar: Member names contain `..'
$ tar -tf tar
../foo/
../foo/foo
$ rm -rf ../foo
$ ls -ld ../foo
ls: ../foo: No such file or directory
$ tar -xf tar ../foo
tar: ../foo/: Member name contains `..'
tar: ../foo/foo: Member name contains `..'
tar: Error exit delayed from previous errors
$ ls -ld ../foo
ls: ../foo: No such file or directory
$ tar --absolute-names -xf tar ../foo
$ echo $?
0
$ find ../foo -print
../foo
../foo/foo

Doofus

unread,
Nov 1, 2004, 2:18:04 AM11/1/04
to
micha...@yahoo.com wrote...

I would probably have never gleened that from the documentation.

Thank you very much.

0 new messages