[BangPypers] ReadError: opening tar file

murugadoss murugadoss2884 at gmail.com
Fri Jun 4 13:25:37 CEST 2010


It is for collecting the binary data from the client system. wherein the
binary data is sent in tar.gz format. The exact task is to collect the data,
untar and do the processing.

Initially the program is written in the 32-bit linux pc. It is completely
working here. Today, i loaded the same program in the server pc (which is a
64-bit x86 pc), i end up with issue.

The crc check and md5 check are same in the both the p*c.*
*
*
*for 32-bit pc*:

tarfile.is_tarfile(tar)
comptype gz
func <bound method type.gzopen of <class 'tarfile.TarFile'>>
func1 <tarfile.TarFile object at 0xb7f02e2c>
True
>>> import binascii
>>> data = open(tar,'rb').read()
>>> binascii.crc32(data)
1270541744
>>> import hashlib
>>> m=hashlib.md5()
>>> m.update(data)
>>> m.hexdigest()
'2763563634899e9d1447731ed465f6a5'
>>>

*64-bit pc:*
*
*
>>>tarfile.is_tarfile(tar)
func <bound method type.gzopen of <class 'tarfile.TarFile'>>
func1 func <bound method type.taropen of <class 'tarfile.TarFile'>>
func1 func <bound method type.bz2open of <class 'tarfile.TarFile'>>
func1
False
>>> import binascii
>>> data = open(tar,'rb').read()
>>> binascii.crc32(data)
1270541744
>>> import hashlib
>>> m=hashlib.md5()
>>> m.update(data)
>>> m.hexdigest()
'2763563634899e9d1447731ed465f6a5

Do GCC version may affect in any way ??

Thanks for the reply

--
Thanks & Regards
V.Murugadoss


On Fri, Jun 4, 2010 at 7:55 PM, Anand Balachandran Pillai <
abpillai at gmail.com> wrote:

> On Fri, Jun 4, 2010 at 4:15 PM, murugadoss <murugadoss2884 at gmail.com>
> wrote:
>
> > Thank for the reply.
> > The tar file is not corrupted, i am using the same file in 32-bit m/c and
> > able to extract it. I have attached this output also with the mail.
> > I am getting this problem only in 64-bit m/c.
> >
>
>  And what is this whole exercise aimed at ? Why are you
>  trying to open a tar file using Python first in a 32-bit and then
>  on a 64-bit machine ? Can we have some background ? Otherwise
>  this looks like a pretty weird exercise to me.
>
>  Tar files are platform agnostic. Otherwise, you would
>  have a nightmare opening tar files downloaded from the internet.
>  A tar file created in 32 bit Linux should open in 64 bit Linux
>  and vice-verza.
>
>  Most probably the file got corrupted when you copied (or
>  downloaded ?) it to the 32 bit machine. Try this on ur
>  machines - they should print the same value.
>
>  >>> import binascii
> >>> data = open(tar, 'rb').read()
> >>> binascii.crc32(data)
>
> Also, try an md5 checksum.
>
> >>> import hashlib
> >>> m=hashlib.md5()
> >>> m.update(data)
> >>> m.hexdigest()
> '5b603d8b5dbf6004d802efc4dedac68c'
>
>
> >
> >
> --
> --Anand
> _______________________________________________
> BangPypers mailing list
> BangPypers at python.org
> http://mail.python.org/mailman/listinfo/bangpypers
>


More information about the BangPypers mailing list