Skip to content

Commit

Permalink
[3.11] pythongh-91387: Fix tarfile test on WASI (pythonGH-93984)
Browse files Browse the repository at this point in the history
WASI's rmdir() syscall does not like the trailing slash..
                    (cherry picked from commit dd78aae)

                    Co-authored-by: Christian Heimes <christian@python.org>
  • Loading branch information
tiran authored and ethanfurman committed Jun 18, 2022
1 parent 579e985 commit ec54cd5
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions Lib/test/test_tarfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -1020,6 +1020,21 @@ def test_header_offset(self):
"iso8859-1", "strict")
self.assertEqual(tarinfo.type, self.longnametype)

def test_longname_directory(self):
# Test reading a longlink directory. Issue #47231.
longdir = ('a' * 101) + '/'
with os_helper.temp_cwd():
with tarfile.open(tmpname, 'w') as tar:
tar.format = self.format
try:
os.mkdir(longdir)
tar.add(longdir)
finally:
os.rmdir(longdir.rstrip("/"))
with tarfile.open(tmpname) as tar:
self.assertIsNotNone(tar.getmember(longdir))
self.assertIsNotNone(tar.getmember(longdir.removesuffix('/')))


class GNUReadTest(LongnameTest, ReadTest, unittest.TestCase):

Expand Down

0 comments on commit ec54cd5

Please sign in to comment.