This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Jeffrey.Kintscher
Recipients Dobatymo, Jeffrey.Kintscher, matrixise, serhiy.storchaka, twouters
Date 2019-06-03.00:04:59
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1559520300.04.0.892428580907.issue37005@roundup.psfhosted.org>
In-reply-to
Content
The bz2 library and the bzip2 utility generate identical files. For example:

>>> import bz2
>>> with bz2.open('bz2test.txt.bz2', mode='wb') as f:
...     f.write(b'foobar')
... 
6

generates this file:

$ hexdump bz2test.txt.bz2
0000000 42 5a 68 39 31 41 59 26 53 59 52 c0 3d c1 00 00
0000010 01 01 80 31 00 90 00 20 00 21 83 41 9a 09 88 1c
0000020 5d c9 14 e1 42 41 4b 00 f7 04                  
000002a

and

$ echo -n 'foobar' | bzip2 -c > bzip2test.txt.bz2

generates this file:

$ hexdump bzip2test.txt.bz2 
0000000 42 5a 68 39 31 41 59 26 53 59 52 c0 3d c1 00 00
0000010 01 01 80 31 00 90 00 20 00 21 83 41 9a 09 88 1c
0000020 5d c9 14 e1 42 41 4b 00 f7 04                  
000002a

The StreamFooter is there, it is just difficult to see because it isn't byte-aligned. It starts at byte 0x20 bit 6.  If you take 0x5dc914e14241 and shift it right two bits, you get the StreamFooter FooterMagic value: 0x177245385090. It is followed by a 32-bit CRC and two zero-bits of padding to byte-align the end of the file.
History
Date User Action Args
2019-06-03 00:05:00Jeffrey.Kintschersetrecipients: + Jeffrey.Kintscher, twouters, serhiy.storchaka, matrixise, Dobatymo
2019-06-03 00:05:00Jeffrey.Kintschersetmessageid: <1559520300.04.0.892428580907.issue37005@roundup.psfhosted.org>
2019-06-03 00:05:00Jeffrey.Kintscherlinkissue37005 messages
2019-06-03 00:04:59Jeffrey.Kintschercreate