[comp.unix.xenix] chksum in tar header block

spaf@cs.purdue.EDU (Gene Spafford) (01/27/88)

Look in section 5 of your manual, at the entry that describes the
tar tape format.  It explains how the checksum is calculated.

-- 
Gene Spafford
Dept. of Computer Sciences, Purdue University, W. Lafayette IN 47907-2004
Internet:  spaf@cs.purdue.edu	uucp:	...!{decwrl,gatech,ucbvax}!purdue!spaf

hal@ugacs.UUCP (Hal N. Brooks) (01/27/88)

In Message-ID: <243@mancol.UUCP> samperi@mancol.UUCP writes:

>  Can somebody explain how the chksum in a tar header block is computed? ...
>  I can't seem to compute a checksum by hand that agrees with the
>  figure displayed (using od -c for the dump). ...

and spaf replies:

>  Look in section 5 of your manual, at the entry that describes the
>  tar tape format.  It explains how the checksum is calculated.

I found that our AT&T System V documentation didn't include the tar(5)
page, so I had to rely on tar(5) from someone else's Ultrix manual.  At
any rate, you seem to already have access to this information.

The discrepancy I noted was that this manual page stated:

   "`Chksum' is a decimal ASCII value ..."

when it SHOULD have said:

   "`Chksum' is an OCTAL ASCII value ..."

Actually I shouldn't say `should', since I was using header documentation
belonging to a different system.

I have no comments on XENIX.

Let me know if this works for you.


-hal    (...gatech!ugacs!hal)

Hal Brooks
Univ. of Ga.
CS Dept. Systems Support

No warranty is expressed or implied.

phn@dde.uucp (Per H. Nielsen) (02/03/88)

In article <243@mancol.UUCP>, samperi@mancol.UUCP (Dominick Samperi) writes:
 > Can somebody explain how the chksum in a tar header block is computed? My
 > docs say that it is equal to the sum of the bytes in the 512-byte header,
 > assuming that all bytes of the checksum itself are blanks.
 > On the other hand, when I dump a tar archive from
 > either system I can't seem to compute a checksum by hand that
 > agrees with the figure displayed.


It is correct that the checksum is the sum of the 512 header
bytes after filling the checksum field itself with spaces.

The checksum is then written as a string giving the *octal*
representation of the checksum. Maybe you forgot to convert
your hand computed sum to octal ??.

-- 
+---------------------------------------------------------------------------+
|   Per H. Nielsen @ Dansk Data Elektronik A/S,                             |
|   E-mail:  ..!uunet!mcvax!diku!dde!phn  or  phn@dde.uucp                  |
+---------------------------------------------------------------------------+