Skip to content

Commit 43e66d5

Browse files
committed
Add test
1 parent 52b2be0 commit 43e66d5

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

Lib/test/test_tarfile.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1621,6 +1621,22 @@ def test_symlink_size(self):
16211621
finally:
16221622
os_helper.unlink(path)
16231623

1624+
@os_helper.skip_unless_symlink
1625+
def test_symlink_target_normalization(self):
1626+
# Test for gh-151669.
1627+
path = os.path.join(TEMPDIR, "symlink")
1628+
target = "subdir/link/target"
1629+
os.symlink(target.replace("/", os.sep), path)
1630+
try:
1631+
tar = tarfile.open(tmpname, self.mode)
1632+
try:
1633+
tarinfo = tar.gettarinfo(path)
1634+
self.assertEqual(tarinfo.linkname, target)
1635+
finally:
1636+
tar.close()
1637+
finally:
1638+
os_helper.unlink(path)
1639+
16241640
def test_add_self(self):
16251641
# Test for #1257255.
16261642
dstname = os.path.abspath(tmpname)

0 commit comments

Comments
 (0)