@@ -3755,6 +3755,32 @@ def test_deep_symlink(self):
3755
3755
else :
3756
3756
self .expect_file ('linkdir/symlink' , size = 3 )
3757
3757
3758
+ @symlink_test
3759
+ def test_chains (self ):
3760
+ # Test chaining of symlinks/hardlinks.
3761
+ # Symlinks are created before the files they point to.
3762
+ with ArchiveMaker () as arc :
3763
+ arc .add ('linkdir/symlink' , symlink_to = 'hardlink' )
3764
+ arc .add ('symlink2' , symlink_to = os .path .join (
3765
+ 'linkdir' , 'hardlink2' ))
3766
+ arc .add ('targetdir/target' , size = 3 )
3767
+ arc .add ('linkdir/hardlink' , hardlink_to = 'targetdir/target' )
3768
+ arc .add ('linkdir/hardlink2' , hardlink_to = 'linkdir/symlink' )
3769
+
3770
+ for filter in 'tar' , 'data' , 'fully_trusted' :
3771
+ with self .check_context (arc .open (), filter ):
3772
+ self .expect_file ('targetdir/target' , size = 3 )
3773
+ self .expect_file ('linkdir/hardlink' , size = 3 )
3774
+ self .expect_file ('linkdir/hardlink2' , size = 3 )
3775
+ if os_helper .can_symlink ():
3776
+ self .expect_file ('linkdir/symlink' , size = 3 ,
3777
+ symlink_to = 'hardlink' )
3778
+ self .expect_file ('symlink2' , size = 3 ,
3779
+ symlink_to = 'linkdir/hardlink2' )
3780
+ else :
3781
+ self .expect_file ('linkdir/symlink' , size = 3 )
3782
+ self .expect_file ('symlink2' , size = 3 )
3783
+
3758
3784
def test_modes (self ):
3759
3785
# Test how file modes are extracted
3760
3786
# (Note that the modes are ignored on platforms without working chmod)
0 commit comments