@@ -3332,6 +3332,19 @@ def open(self, **kwargs):
3332
3332
bio = io .BytesIO (self .contents )
3333
3333
return tarfile .open (fileobj = bio , ** kwargs )
3334
3334
3335
+ # Under WASI, `os_helper.can_symlink` is False to make
3336
+ # `skip_unless_symlink` skip symlink tests. "
3337
+ # But in the following tests we use can_symlink to *determine* which
3338
+ # behavior is expected.
3339
+ # Like other symlink tests, skip these on WASI for now.
3340
+ if support .is_wasi :
3341
+ def symlink_test (f ):
3342
+ return unittest .skip ("WASI: Skip symlink test for now" )(f )
3343
+ else :
3344
+ def symlink_test (f ):
3345
+ return f
3346
+
3347
+
3335
3348
class TestExtractionFilters (unittest .TestCase ):
3336
3349
3337
3350
# A temporary directory for the extraction results.
@@ -3441,6 +3454,7 @@ def test_absolute(self):
3441
3454
tarfile .AbsolutePathError ,
3442
3455
"""['"].*escaped.evil['"] has an absolute path""" )
3443
3456
3457
+ @symlink_test
3444
3458
def test_parent_symlink (self ):
3445
3459
# Test interplaying symlinks
3446
3460
# Inspired by 'dirsymlink2a' in jwilk/traversal-archives
@@ -3484,6 +3498,7 @@ def test_parent_symlink(self):
3484
3498
with self .check_context (arc .open (), 'data' ):
3485
3499
self .expect_file ('parent/evil' )
3486
3500
3501
+ @symlink_test
3487
3502
def test_parent_symlink2 (self ):
3488
3503
# Test interplaying symlinks
3489
3504
# Inspired by 'dirsymlink2b' in jwilk/traversal-archives
@@ -3518,6 +3533,7 @@ def test_parent_symlink2(self):
3518
3533
"""'current/parent' would link to ['"].*['"], """
3519
3534
+ "which is outside the destination" )
3520
3535
3536
+ @symlink_test
3521
3537
def test_absolute_symlink (self ):
3522
3538
# Test symlink to an absolute path
3523
3539
# Inspired by 'dirsymlink' in jwilk/traversal-archives
@@ -3547,6 +3563,7 @@ def test_absolute_symlink(self):
3547
3563
tarfile .AbsoluteLinkError ,
3548
3564
"'parent' is a symlink to an absolute path" )
3549
3565
3566
+ @symlink_test
3550
3567
def test_sly_relative0 (self ):
3551
3568
# Inspired by 'relative0' in jwilk/traversal-archives
3552
3569
with ArchiveMaker () as arc :
@@ -3580,6 +3597,7 @@ def test_sly_relative0(self):
3580
3597
+ "'.*moo', which is outside "
3581
3598
+ "the destination" )
3582
3599
3600
+ @symlink_test
3583
3601
def test_sly_relative2 (self ):
3584
3602
# Inspired by 'relative2' in jwilk/traversal-archives
3585
3603
with ArchiveMaker () as arc :
0 commit comments