How to correctly extract a .tar.gz with md5.sum on solaris 10

gccgzipsolaristar

I am trying to extract a gcc-4.9.0.tar.gz downloaded from one of the gcc mirror site.
In order to check the md5 signature on it before I gunzip it I did

digest -a md5 -v gcc-4.9.0.tar.gz

which gave

md5 (gcc-4.9.0.tar.gz) = fe8786641134178ecfeee2dc7644a0d8

This matches with the md5.sum in the directory downloaded from the source.

Then I did

gzip -dc gcc-4.9.0.tar.gz | tar xvf -

The extraction began but soon terminated with a

 tar: directory checksum error

I also tried to gunzip and untar separately like this

 gunzip gcc-4.9.0.tar.gz

Then

tar -xvf gcc-4.9.0.tar

but it also ended with a checksum error.

Please How do I resolve this?

Best Answer

You need to use gtar, it is usually preinstalled with package SUNWgtar:

gzip -dc gcc-4.9.0.tar.gz | /usr/sfw/bin/gtar -xf -
echo $?
0

Native Solaris unpatched tar may have problems with files created with GNU tar. See answer of @schily why.