diff options
author | Neal Norwitz <nnorwitz@gmail.com> | 2006-08-21 18:43:51 +0000 |
---|---|---|
committer | Neal Norwitz <nnorwitz@gmail.com> | 2006-08-21 18:43:51 +0000 |
commit | 7443b80549ad7d74c22d94e953ebe89137037f08 (patch) | |
tree | 1f25768bfba27f472cc602f869146b272d96e68d /Lib/test | |
parent | db232dc86a9a9992b7f0e9bdbc27426cc04ccf52 (diff) | |
download | cpython-git-7443b80549ad7d74c22d94e953ebe89137037f08.tar.gz |
Backport 51432:
Fix bug #1543303, tarfile adds padding that breaks gunzip.
Patch # 1543897. (remove the padding)
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_tarfile.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/Lib/test/test_tarfile.py b/Lib/test/test_tarfile.py index 8ee0f41ea8..ebcb8c59f5 100644 --- a/Lib/test/test_tarfile.py +++ b/Lib/test/test_tarfile.py @@ -324,6 +324,27 @@ class WriteSize0Test(BaseTest): class WriteStreamTest(WriteTest): sep = '|' + def test_padding(self): + self.dst.close() + + if self.comp == "gz": + f = gzip.GzipFile(self.dstname) + s = f.read() + f.close() + elif self.comp == "bz2": + f = bz2.BZ2Decompressor() + s = file(self.dstname).read() + s = f.decompress(s) + self.assertEqual(len(f.unused_data), 0, "trailing data") + else: + f = file(self.dstname) + s = f.read() + f.close() + + self.assertEqual(s.count("\0"), tarfile.RECORDSIZE, + "incorrect zero padding") + + class WriteGNULongTest(unittest.TestCase): """This testcase checks for correct creation of GNU Longname and Longlink extensions. |