mirror of
https://github.com/python/cpython.git
synced 2025-08-09 11:29:45 +00:00
gh-108948: Skip test_tarfile.test_modes() on EFTYPE error (#109697)
On FreeBSD, regular users cannot set the sticky bit. Skip the test if
chmod() fails with EFTYPE error.
(cherry picked from commit 26e06ad617
)
This commit is contained in:
parent
05b139b599
commit
84ef145d85
1 changed files with 16 additions and 3 deletions
|
@ -1,3 +1,4 @@
|
||||||
|
import errno
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
import io
|
import io
|
||||||
|
@ -3798,8 +3799,20 @@ class TestExtractionFilters(unittest.TestCase):
|
||||||
tmp_filename = os.path.join(TEMPDIR, "tmp.file")
|
tmp_filename = os.path.join(TEMPDIR, "tmp.file")
|
||||||
with open(tmp_filename, 'w'):
|
with open(tmp_filename, 'w'):
|
||||||
pass
|
pass
|
||||||
os.chmod(tmp_filename, os.stat(tmp_filename).st_mode | stat.S_ISVTX)
|
try:
|
||||||
|
try:
|
||||||
|
os.chmod(tmp_filename,
|
||||||
|
os.stat(tmp_filename).st_mode | stat.S_ISVTX)
|
||||||
|
except OSError as exc:
|
||||||
|
if exc.errno == getattr(errno, "EFTYPE", 0):
|
||||||
|
# gh-108948: On FreeBSD, regular users cannot set
|
||||||
|
# the sticky bit.
|
||||||
|
self.skipTest("chmod() failed with EFTYPE: "
|
||||||
|
"regular users cannot set sticky bit")
|
||||||
|
else:
|
||||||
|
raise
|
||||||
have_sticky_files = (os.stat(tmp_filename).st_mode & stat.S_ISVTX)
|
have_sticky_files = (os.stat(tmp_filename).st_mode & stat.S_ISVTX)
|
||||||
|
finally:
|
||||||
os.unlink(tmp_filename)
|
os.unlink(tmp_filename)
|
||||||
|
|
||||||
os.mkdir(tmp_filename)
|
os.mkdir(tmp_filename)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue