bug-tar
[Top][All Lists]
Advanced

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

[Bug-tar] Verifying a tar File.


From: Ralph Corderoy
Subject: [Bug-tar] Verifying a tar File.
Date: Sat, 20 Aug 2005 17:13:58 +0100

Hi,

I use tar with -g to create incremental backups from some home-grown
scripts.  Recently, I've moved to Ubuntu.

    $ tar --version
    tar (GNU tar) 1.14
    Copyright (C) 2004 Free Software Foundation, Inc.
    This program comes with NO WARRANTY, to the extent permitted by law.
    You may redistribute it under the terms of the GNU General Public License;
    see the file named COPYING for details.
    Written by John Gilmore and Jay Fenlason.
    $ apt-show-versions -p tar
    tar/unknown uptodate 1.14-2

After creating the tar file my script used to store the output of `tar
tvf' for convenience but also as a means of checking tar could read the
file it had just created without complaint.  I've just gone back to a
couple of these tar files and am now getting errors and warnings that
`tar tvf' doesn't trigger.

    $ tar tvf big.tar >/dev/null
    $ echo $?
    0

No stderr output and exit status is OK.

    $ tar xRvf big.tar nonexistentfile
    block 1: level 0 backup of blake on 20050807-225123
    Reading `level 0 backup of blake on 20050807-225123'
    block 521103: tar: Skipping to next header
    block 1075261: ** Block of NULs **
    tar: nonexistentfile: Not found in archive
    tar: Error exit delayed from previous errors
    $ echo $?
    2

The `Skipping to next header' seems to be the error recovery after not
finding a header as expected.  I'd have thought tar's skipping from
header to header when doing a `tar tvf' would have hit the same problem?

There's the separate issue of what's wrong with the header since the
same version of tar created the file earlier this month.  Nothing's
touched it apart from bzip2 in the mean time.

big.tar was the `level 0' backup.  Here's one of the incremental ones on
it that has a different problem.

    $ tar tvf small.tar >/dev/null
    $ echo $?
    0
    $ tar xf small.tar nonexistentfile
    tar: nonexistentfile: Not found in archive
    tar: Error exit delayed from previous errors
    $ echo $?
    2
    $ tar xf small.tar home/ralph/nonexistentfile
    tar: home/ralph/nonexistentfile: Not found in archive
    tar: Error exit delayed from previous errors
    $ echo $?
    2

OK so far.

    $ tar xf small.tar home/ralph/pysloc
    tar: home/ralph/.mozilla/firefox/mc0oqdco.default/cert8.db: \
        invalid sparse archive member
    tar: Skipping to next header
    tar: Error exit delayed from previous errors
    $ echo $?
    2
    $ test -f home/ralph/pysloc; echo $?
    0
    $

So `tar tvf' didn't notice the sparse file problem, nor did extracting a
file that wasn't there, but extracting one that was does complain.  And
again, apart from the unpredictable (to me, not knowing the code)
reporting of the problem, how did the sparse archive member become
invalid?  There were no issues raised when creating the tar file.

Lastly, what I suppose I really want, seeing that `tar tvf' doesn't do
it, is an option for tar to check the integrity of a tar file by examing
*all* its meta-data.  The bytes making up a file obviously can't be
checked as I don't believe the file format has a checksum or digest for
the file's content.  But every other bit of data should be checked so
any problems appear then and not later as above.  --verify isn't really
it since I don't want to check the file's contents against local disc.

Insight from the list sought!

Cheers,


Ralph.





reply via email to

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