Subject: Re: tar verify
To: Sanesh Bodasing <saneshb@cat.co.za>
From: Nick <nick@glimmer.demon.co.uk>
List: netbsd-users
Date: 12/20/2000 02:20:25
On Fri, 15 Dec 2000 15:36:31 -0000, you wrote:

> It seems that tar returns a value of 0 irrespective of=20
> the tar being successfull of unsuccessfull. This makes it=20
> difficult to verify that the tar actullly worked.
> Does anyone know how to verify if a tar was successfull?

You have my greatest sympathy - it is one of my deeper regrets about
Unix commands/shells that they don't always make it easy to find out
what happened - especially with the tar command.  Actually the best I
can tell you right now (at home without a Un*x to hand) is that on our
HPUX systems at work the *opposite* is true : on creating an archive
tar returns the *same* non-zero error status value (5 IIRC)
irrespective of whether=20
    a) a trivial non-fatal event occurred such as an input file
       being encountered whose GID was unknown.
    b) a more noteworthy event occurred, such as a specified file
       not being found.
or  c) a horrific thing happened, such as the tape snapped and=20
       the whole backup was abandoned.
(but it *does* return zero on complete success).

This is not clever, but we're apparently stuck with it - when I
queried it with HP they said they couldn't enhance the behaviour as
this would make their tar inconsistent with other Unixen.  I'm
interested to hear of your tar-always-returns-zero problem, and will
be testing this tomorrow on Linux, NetBSD/pmax, Digital Unix and
Ultrix.  I'll let you know what I find.  What were *you* making tar do
when it returned zero ?

I can't help thinking something as fundamental as a backup command
should be as clear and precise as possible when reporting its exit
status.

Cheers,

Nick
Bristol, UK
--
Lottery (noun): a tax on people who are bad at maths.