bug-tar
[Top][All Lists]
Advanced

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

Re: [Bug-tar] Cannot: extract a member reliably with possible leading do


From: Viktor Sergiienko
Subject: Re: [Bug-tar] Cannot: extract a member reliably with possible leading dot-slash
Date: Tue, 11 Dec 2018 22:34:03 -0800

Thanks, but this is exactly the case that introduces subtle problems.
It doesn't help if there is another file in the archive, with the same
name but in a different directory.

Like here:
===
mkdir -p dir

echo member1 > member1
echo member2 > member2
echo "member1 in directory" > dir/member1

gnutar cf test.tar member1 member2 dir
gnutar xOf test.tar --wildcards --no-anchored member1 > member1-extracted
===

There exists no general way to extract precisely the root member1,
which at the same time supports archives with "./member1" path.
We can tailor a command line to a specific archive, but this doesn't
solve the general case.

On Tue, Dec 11, 2018 at 9:31 PM Sergey Poznyakoff <address@hidden> wrote:
>
> Viktor Sergiienko <address@hidden> ha escrit:
>
> > > $ tar tvf archive1.tar
> > > -rw-r--r-- root/root 567 2016-09-18 14:28 member1
> > > -rw-r--r-- root/root 1696 2016-09-18 14:28 member2
> > > $ tar tvf archive2.tar
> > > -rw-r--r-- root/root 567 2016-09-18 14:28 ./member1
> > > -rw-r--r-- root/root 1696 2016-09-18 14:28 ./member2
> > >
> > > How to extract member1 reliably from either of two archives?
>
> Use the --no-anchored option.
>
> Regards,
> Sergey



reply via email to

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