Skip to content

Commit 7d81259

Browse files
committed
gh-157266: Adjust test for Windows
On Windows (no symlinks, no hardlinks), the behaviour is the same as without the fix in GH-157266: - a/t/dummy is extracted - b/ is extracted - c/ is *not* created (the target, a/t, is not in the archive) - c/escape: c/ is created; escape is skipped (target, c/../../link_here, is not in archive) - c is not recreated as a directory - boom is not created (target is c/escape, which falls back to ..\..\link_here, which does not exist in archive)
1 parent 2360bda commit 7d81259

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

Lib/test/test_tarfile.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4621,15 +4621,15 @@ def test_sneaky_hardlink_fallback(self):
46214621
for filter in 'tar', 'fully_trusted':
46224622
with self.subTest(filter), self.check_context(arc.open(), filter):
46234623
if not os_helper.can_symlink():
4624-
if filter == 'tar':
4624+
if filter == 'fully_trusted' or sys.platform == "win32":
4625+
self.expect_file("a/t/dummy")
4626+
self.expect_file("b/")
4627+
self.expect_file("c/")
4628+
else:
46254629
self.expect_exception(
46264630
tarfile.LinkFallbackError,
46274631
"link 'boom' would be extracted as a copy of "
46284632
+ "'c/escape', which was rejected")
4629-
else:
4630-
self.expect_file("a/t/dummy")
4631-
self.expect_file("b/")
4632-
self.expect_file("c/")
46334633
else:
46344634
self.expect_file("a/t/dummy")
46354635
self.expect_file("b/")

0 commit comments

Comments
 (0)