bug-tar
[Top][All Lists]
Advanced

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

Re: [Bug-tar] Tar Update command


From: Helmut Waitzmann
Subject: Re: [Bug-tar] Tar Update command
Date: Wed, 17 Sep 2008 03:57:56 +0200
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1 (gnu/linux)

"Clinton Mills" <address@hidden> writes:

>I am using the update command to try to speed up our back ups. I was
>thinking of using the update command to try and accomplish this.
> 
>I am having a small problem with my test. Am I doing something wrong, please
>see below?
> 
>First Test
>tar -v --update --file /root/test.tar 1 2 3 4
> 
>This shows all 4 files were added to the archive. Great! Now let's run it
>again. This shows no files were added to the archive, Great! Now let's
>change file 3. Now let's run it again and it shows it added 3 to the
>archive, it worked great!
> 
>Let's do the same thing but with the following command using the full path
>to each file.
>tar -v --update --file /root/test.tar /tmp/1 /tmp/2 /tmp/3 /tmp/4
>This shows all four files are added to the archive. Great. Now let's run it
>again!! This time it shows all four files were added to the archive, even
>though none of them changed??

Because probably there has appeared a warning message in the first run:

Removing leading `/' from member names

That is, the tar file now contains the members "tmp/1", "tmp/2", "tmp/3",
and "tmp/4" rather than "/tmp/1", "/tmp/2", "/tmp/3", and "/tmp/4".  The
command

$ tar -t -v --file /root/test.tar

will show that.

>Why would this add all 4 files to the archive every time just b/c I put the
>full path?

As the members which are already in the archive have different names
(i.e. the leading "/" is missing), they will be added again when
updating.

See
<http://www.gnu.org/software/tar/manual/html_node/absolute.html#SEC113>
for a discussion of this situation.

The solution would be to not give the leading "/" with the member names
but to use the option "-C":

$ tar -v --update --file /root/test.tar -C / -- tmp/1 tmp/2 tmp/3 tmp/4 

In this case

>tar -v --update --file /root/test.tar /home

this would be

$ tar -v --update --file /root/test.tar -C / -- home

There is an option "--absolute-names" which can cause problems, though,
should one need to extract an archive created with it to a different
directory than "/".  So, the recommended solution is to not use absolute
member names but use the option "-C" with a parameter "/".

It's always wise to not only avoid absolute member names but to start all
(then relative) member names with "./", so your command should be

$ tar -v --update --file /root/test.tar -C / -- ./home
-- 
Wer mir E-Mail schreiben will, stelle   |   When writing me e-mail, please
bitte vor meine E-Mail-Adresse meinen   |   precede my e-mail address with
Vor- und Nachnamen, etwa so:            |   my full name, like
Helmut Waitzmann <address@hidden>, (Helmut Waitzmann) address@hidden




reply via email to

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