, RecoverCorruptHeaderGZAESTest \
, RecoverCorruptEntireHeaderTest \
, RecoverCorruptEntireHeaderGZTest \
- , RecoverCorruptEntireHeaderGZAESTest
+ , RecoverCorruptEntireHeaderGZAESTest \
+ , RecoverCorruptTrailingDataTest \
+ , RecoverCorruptTrailingDataGZTest \
+ , RecoverCorruptTrailingDataGZAESTest
from testing.test_rescue_tar import RescueTarTest
from testing.test_encryption import EncryptionTest
from testing.test_deltatar import (DeltaTarTest, DeltaTar2Test,
, RecoverCorruptEntireHeaderTest
, RecoverCorruptEntireHeaderGZTest
, RecoverCorruptEntireHeaderGZAESTest
+ , RecoverCorruptTrailingDataTest
+ , RecoverCorruptTrailingDataGZTest
+ , RecoverCorruptTrailingDataGZAESTest
]:
try:
t = group (n)
flip_bits (fname, tarfile.BLOCKSIZE + 1)
+def corrupt_trailing_data (_, fname, compress, encrypt):
+ """
+ Modify the byte following the object header structure of the format.
+ """
+ junk = os.urandom (42)
+ fd = os.open (fname, os.O_WRONLY | os.O_APPEND)
+ os.write (fd, junk)
+ os.close (fd)
+
###############################################################################
## tests ##
CORRUPT = corrupt_entire_header
MISMATCHES = 0
+
+class RecoverCorruptTrailingDataTest (RecoverTest):
+ # plain Tar is indifferent against traling data and the results
+ # are consistent
+ COMPRESSION = None
+ PASSWORD = None
+ FAILURES = 0
+ CORRUPT = corrupt_trailing_data
+ MISMATCHES = 0
+
+
+class RecoverCorruptTrailingDataGZTest (RecoverTest):
+ # reading past the final object will cause decompression failure;
+ # all objects except for the last survive unharmed though
+ COMPRESSION = "#gz"
+ PASSWORD = None
+ FAILURES = 1
+ CORRUPT = corrupt_trailing_data
+ MISMATCHES = 0
+
+
+class RecoverCorruptTrailingDataGZAESTest (RecoverTest):
+ COMPRESSION = "#gz"
+ PASSWORD = TEST_PASSWORD
+ FAILURES = 0
+ CORRUPT = corrupt_trailing_data
+ MISMATCHES = 0
+
+