Skip to content

Commit ec54cd5

Browse files
tiranethanfurman
authored andcommitted
[3.11] pythongh-91387: Fix tarfile test on WASI (pythonGH-93984)
WASI's rmdir() syscall does not like the trailing slash.. (cherry picked from commit dd78aae) Co-authored-by: Christian Heimes <christian@python.org>
1 parent 579e985 commit ec54cd5

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

Lib/test/test_tarfile.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1020,6 +1020,21 @@ def test_header_offset(self):
10201020
"iso8859-1", "strict")
10211021
self.assertEqual(tarinfo.type, self.longnametype)
10221022

1023+
def test_longname_directory(self):
1024+
# Test reading a longlink directory. Issue #47231.
1025+
longdir = ('a' * 101) + '/'
1026+
with os_helper.temp_cwd():
1027+
with tarfile.open(tmpname, 'w') as tar:
1028+
tar.format = self.format
1029+
try:
1030+
os.mkdir(longdir)
1031+
tar.add(longdir)
1032+
finally:
1033+
os.rmdir(longdir.rstrip("/"))
1034+
with tarfile.open(tmpname) as tar:
1035+
self.assertIsNotNone(tar.getmember(longdir))
1036+
self.assertIsNotNone(tar.getmember(longdir.removesuffix('/')))
1037+
10231038

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

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy