Back to index

python3.2  3.2.2
Public Member Functions
test.test_tarfile.LimitsTest Class Reference

List of all members.

Public Member Functions

def test_ustar_limits
def test_gnu_limits
def test_pax_limits

Detailed Description

Definition at line 1518 of file test_tarfile.py.


Member Function Documentation

Definition at line 1551 of file test_tarfile.py.

01551 
01552     def test_gnu_limits(self):
01553         tarinfo = tarfile.TarInfo("123/" * 126 + "longname")
01554         tarinfo.tobuf(tarfile.GNU_FORMAT)
01555 
01556         tarinfo = tarfile.TarInfo("longlink")
01557         tarinfo.linkname = "123/" * 126 + "longname"
01558         tarinfo.tobuf(tarfile.GNU_FORMAT)
01559 
01560         # uid >= 256 ** 7
01561         tarinfo = tarfile.TarInfo("name")
01562         tarinfo.uid = 0o4000000000000000000
01563         self.assertRaises(ValueError, tarinfo.tobuf, tarfile.GNU_FORMAT)

Here is the call graph for this function:

Definition at line 1564 of file test_tarfile.py.

01564 
01565     def test_pax_limits(self):
01566         tarinfo = tarfile.TarInfo("123/" * 126 + "longname")
01567         tarinfo.tobuf(tarfile.PAX_FORMAT)
01568 
01569         tarinfo = tarfile.TarInfo("longlink")
01570         tarinfo.linkname = "123/" * 126 + "longname"
01571         tarinfo.tobuf(tarfile.PAX_FORMAT)
01572 
01573         tarinfo = tarfile.TarInfo("name")
01574         tarinfo.uid = 0o4000000000000000000
01575         tarinfo.tobuf(tarfile.PAX_FORMAT)
01576 

Definition at line 1520 of file test_tarfile.py.

01520 
01521     def test_ustar_limits(self):
01522         # 100 char name
01523         tarinfo = tarfile.TarInfo("0123456789" * 10)
01524         tarinfo.tobuf(tarfile.USTAR_FORMAT)
01525 
01526         # 101 char name that cannot be stored
01527         tarinfo = tarfile.TarInfo("0123456789" * 10 + "0")
01528         self.assertRaises(ValueError, tarinfo.tobuf, tarfile.USTAR_FORMAT)
01529 
01530         # 256 char name with a slash at pos 156
01531         tarinfo = tarfile.TarInfo("123/" * 62 + "longname")
01532         tarinfo.tobuf(tarfile.USTAR_FORMAT)
01533 
01534         # 256 char name that cannot be stored
01535         tarinfo = tarfile.TarInfo("1234567/" * 31 + "longname")
01536         self.assertRaises(ValueError, tarinfo.tobuf, tarfile.USTAR_FORMAT)
01537 
01538         # 512 char name
01539         tarinfo = tarfile.TarInfo("123/" * 126 + "longname")
01540         self.assertRaises(ValueError, tarinfo.tobuf, tarfile.USTAR_FORMAT)
01541 
01542         # 512 char linkname
01543         tarinfo = tarfile.TarInfo("longlink")
01544         tarinfo.linkname = "123/" * 126 + "longname"
01545         self.assertRaises(ValueError, tarinfo.tobuf, tarfile.USTAR_FORMAT)
01546 
01547         # uid > 8 digits
01548         tarinfo = tarfile.TarInfo("name")
01549         tarinfo.uid = 0o10000000
01550         self.assertRaises(ValueError, tarinfo.tobuf, tarfile.USTAR_FORMAT)

Here is the call graph for this function:


The documentation for this class was generated from the following file: