File tree Expand file tree Collapse file tree 1 file changed +16
-3
lines changed Expand file tree Collapse file tree 1 file changed +16
-3
lines changed Original file line number Diff line number Diff line change 1+ import errno
12import sys
23import os
34import io
@@ -3791,9 +3792,21 @@ def test_modes(self):
37913792 tmp_filename = os .path .join (TEMPDIR , "tmp.file" )
37923793 with open (tmp_filename , 'w' ):
37933794 pass
3794- os .chmod (tmp_filename , os .stat (tmp_filename ).st_mode | stat .S_ISVTX )
3795- have_sticky_files = (os .stat (tmp_filename ).st_mode & stat .S_ISVTX )
3796- os .unlink (tmp_filename )
3795+ try :
3796+ try :
3797+ os .chmod (tmp_filename ,
3798+ os .stat (tmp_filename ).st_mode | stat .S_ISVTX )
3799+ except OSError as exc :
3800+ if exc .errno == getattr (errno , "EFTYPE" , 0 ):
3801+ # gh-108948: On FreeBSD, regular users cannot set
3802+ # the sticky bit.
3803+ self .skipTest ("chmod() failed with EFTYPE: "
3804+ "regular users cannot set sticky bit" )
3805+ else :
3806+ raise
3807+ have_sticky_files = (os .stat (tmp_filename ).st_mode & stat .S_ISVTX )
3808+ finally :
3809+ os .unlink (tmp_filename )
37973810
37983811 os .mkdir (tmp_filename )
37993812 os .chmod (tmp_filename , os .stat (tmp_filename ).st_mode | stat .S_ISVTX )
You can’t perform that action at this time.
0 commit comments