From 595781e1b5bfbc9d5599cf53818abf09ca08cf4b Mon Sep 17 00:00:00 2001 From: Hood Chatham Date: Thu, 17 Jul 2025 14:37:58 +0200 Subject: [PATCH 1/2] gh-127146: Emscripten: Set umask to zero in python.sh We think this will fix `test_apropos_empty_doc`. --- Tools/wasm/emscripten/__main__.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Tools/wasm/emscripten/__main__.py b/Tools/wasm/emscripten/__main__.py index c0d58aeaadd2cf..293f1a3c75b57e 100644 --- a/Tools/wasm/emscripten/__main__.py +++ b/Tools/wasm/emscripten/__main__.py @@ -263,6 +263,10 @@ def configure_emscripten_python(context, working_dir): REALPATH=abs_path fi + # Set umask to 0. The buildbot seems to run sometimes with a umask + # of 0o077 which causes one test to fail. + umask 0 + # We compute our own path, not following symlinks and pass it in so that # node_entry.mjs can set sys.executable correctly. # Intentionally allow word splitting on NODEFLAGS. From 643e8892c0549593f1078b5a46b8bf13e93f275d Mon Sep 17 00:00:00 2001 From: Hood Chatham Date: Thu, 17 Jul 2025 16:40:31 +0200 Subject: [PATCH 2/2] More specific fix --- Lib/test/test_pydoc/test_pydoc.py | 5 +++++ Tools/wasm/emscripten/__main__.py | 4 ---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Lib/test/test_pydoc/test_pydoc.py b/Lib/test/test_pydoc/test_pydoc.py index d1d6f4987def0c..005526d994bd62 100644 --- a/Lib/test/test_pydoc/test_pydoc.py +++ b/Lib/test/test_pydoc/test_pydoc.py @@ -1303,6 +1303,11 @@ def test_apropos_with_unreadable_dir(self): @os_helper.skip_unless_working_chmod def test_apropos_empty_doc(self): pkgdir = os.path.join(TESTFN, 'walkpkg') + if support.is_emscripten: + # Emscripten's readdir implementation is buggy on directories + # with read permission but no execute permission. + old_umask = os.umask(0) + self.addCleanup(os.umask, old_umask) os.mkdir(pkgdir) self.addCleanup(rmtree, pkgdir) init_path = os.path.join(pkgdir, '__init__.py') diff --git a/Tools/wasm/emscripten/__main__.py b/Tools/wasm/emscripten/__main__.py index 293f1a3c75b57e..c0d58aeaadd2cf 100644 --- a/Tools/wasm/emscripten/__main__.py +++ b/Tools/wasm/emscripten/__main__.py @@ -263,10 +263,6 @@ def configure_emscripten_python(context, working_dir): REALPATH=abs_path fi - # Set umask to 0. The buildbot seems to run sometimes with a umask - # of 0o077 which causes one test to fail. - umask 0 - # We compute our own path, not following symlinks and pass it in so that # node_entry.mjs can set sys.executable correctly. # Intentionally allow word splitting on NODEFLAGS.