bug-tar
[Top][All Lists]
Advanced

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

Re: [Bug-tar] tar: '--overwrite' cannot be used with '--no-overwrite-dir


From: Somchai Smythe
Subject: Re: [Bug-tar] tar: '--overwrite' cannot be used with '--no-overwrite-dir'
Date: Thu, 19 May 2016 15:30:11 +0700

Thanks for the quick answer.  Now that I know that what I was doing
was wrong all along, I am trying to find a solution that does what I
had intended.

To achieve the goal of being able to unpack archives on top of a live
filesystem but not alter existing system directories, I guess I must
carefully construct a list of files when creating the archive that
does NOT include directories that I need to ensure don't get modified
by the extraction?  Assuming I've created an install in an fake root
directory called ./dir, I'm guessing I need to create my archive in
multiple steps.  I would start with something like this (as root from
the parent of the fake root directory):

find ./dir ! -type d -print0 | \
xargs -0 tar -c -v -f whatever.tar

Followed by a second pass which is an update to add any directories
that I DO want to overwrite from an explicit list like this (where
each element of the list is a directory and ends with a
forward-slash):

tar -r --no-recursion -v -f whatever.tar ./dir/e/ ./dir/e/f/

After this second step is done a separate compression pass could be
done to make the archive smaller with some archiver.

Am I on the right track?


On 5/19/16, Sergey Poznyakoff <address@hidden> wrote:
> Hi Somchai,
>
>> The new tar-1.29 fails with my command line that works well with
>> tar-1.28:
>>
>> gzip -cd /home/tmp/whatever.tgz | \
>> tar --extract --numeric-owner --preserve-permissions \
>>    --no-overwrite-dir --overwrite --verbose -f - ./install
>
> In fact, it did not.  At least, it didn't work the way you expected.  In
> previous versions, when two conflicting options appeared, the last one
> silently took effect.  That means that the above command was effectively
> equivalent to
>
>  gzip -cd /home/tmp/whatever.tgz | \
>  tar --extract --numeric-owner --preserve-permissions \
>      --overwrite --verbose -f - ./install
>
> Since version 1.28, tar explicitly marks such usage as erroneous.
> Please see this thread for details:
>
>   http://lists.gnu.org/archive/html/bug-tar/2015-08/msg00004.html
>
> Regards,
> Sergey
>
>



reply via email to

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