Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit2702e40

Browse files
authored
gh-84461: Fix Emscripten umask and permission issues (GH-94002)
- Emscripten's default umask is too strict, seeemscripten-core/emscripten#17269- getuid/getgid and geteuid/getegid are stubs that always return 0 (root). Disable effective uid/gid syscalls and fix tests that use chmod() current user.- Cannot drop X bit from directory.
1 parent476d302 commit2702e40

File tree

4 files changed

+23
-0
lines changed

4 files changed

+23
-0
lines changed

‎Lib/test/libregrtest/main.py‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -600,6 +600,16 @@ def save_xml_result(self):
600600
forsinET.tostringlist(root):
601601
f.write(s)
602602

603+
deffix_umask(self):
604+
ifsupport.is_emscripten:
605+
# Emscripten has default umask 0o777, which breaks some tests.
606+
# see https://github.com/emscripten-core/emscripten/issues/17269
607+
old_mask=os.umask(0)
608+
ifold_mask==0o777:
609+
os.umask(0o027)
610+
else:
611+
os.umask(old_mask)
612+
603613
defset_temp_dir(self):
604614
ifself.ns.tempdir:
605615
self.tmp_dir=self.ns.tempdir
@@ -660,6 +670,8 @@ def main(self, tests=None, **kwargs):
660670

661671
self.set_temp_dir()
662672

673+
self.fix_umask()
674+
663675
ifself.ns.cleanup:
664676
self.cleanup()
665677
sys.exit(0)

‎Lib/test/test_posix.py‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -787,6 +787,7 @@ def check_stat(uid, gid):
787787
check_stat(uid,gid)
788788

789789
@os_helper.skip_unless_working_chmod
790+
@unittest.skipIf(support.is_emscripten,"getgid() is a stub")
790791
deftest_chown(self):
791792
# raise an OSError if the file does not exist
792793
os.unlink(os_helper.TESTFN)
@@ -798,6 +799,7 @@ def test_chown(self):
798799

799800
@os_helper.skip_unless_working_chmod
800801
@unittest.skipUnless(hasattr(posix,'fchown'),"test needs os.fchown()")
802+
@unittest.skipIf(support.is_emscripten,"getgid() is a stub")
801803
deftest_fchown(self):
802804
os.unlink(os_helper.TESTFN)
803805

@@ -1356,6 +1358,7 @@ def test_chmod_dir_fd(self):
13561358

13571359
@unittest.skipUnless(hasattr(os,'chown')and (os.chowninos.supports_dir_fd),
13581360
"test needs dir_fd support in os.chown()")
1361+
@unittest.skipIf(support.is_emscripten,"getgid() is a stub")
13591362
deftest_chown_dir_fd(self):
13601363
withself.prepare_file()as (dir_fd,name,fullname):
13611364
posix.chown(name,os.getuid(),os.getgid(),dir_fd=dir_fd)

‎Lib/test/test_pydoc.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -934,6 +934,7 @@ def test_apropos_with_unreadable_dir(self):
934934
self.assertEqual(err.getvalue(),'')
935935

936936
@os_helper.skip_unless_working_chmod
937+
@unittest.skipIf(is_emscripten,"cannot remove x bit")
937938
deftest_apropos_empty_doc(self):
938939
pkgdir=os.path.join(TESTFN,'walkpkg')
939940
os.mkdir(pkgdir)

‎Tools/wasm/config.site-wasm32-emscripten‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,13 @@ ac_cv_func_symlinkat=no
4343
ac_cv_func_lchmod=no
4444
ac_cv_func_lchown=no
4545

46+
# geteuid / getegid are stubs and always return 0 (root). The stub breaks
47+
# code that assume effective user root has special permissions.
48+
ac_cv_func_geteuid=no
49+
ac_cv_func_getegid=no
50+
ac_cv_func_seteuid=no
51+
ac_cv_func_setegid=no
52+
4653
# Syscalls not implemented in emscripten
4754
# [Errno 52] Function not implemented
4855
ac_cv_func_preadv2=no

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp