Skip to content

Commit e4ccd46

Browse files
authored
gh-127146: Emscripten: Fix pathlib glob_dotdot test (#135624)
The Emscripten path resolver uses the same mechanism for resolving `..` at a file system root as for resolving symlinks. This is because roots don't store their mountpoints. If the parent of a node is itself, it is a root but it might be a mountpoint in some other file system. If a path has enough `..`'s at the root, it will return ELOOP. Enough turns out to be 49.
1 parent ce58afb commit e4ccd46

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

Lib/test/test_pathlib/test_pathlib.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2954,7 +2954,13 @@ def test_glob_dotdot(self):
29542954
else:
29552955
# ".." segments are normalized first on Windows, so this path is stat()able.
29562956
self.assertEqual(set(p.glob("xyzzy/..")), { P(self.base, "xyzzy", "..") })
2957-
self.assertEqual(set(p.glob("/".join([".."] * 50))), { P(self.base, *[".."] * 50)})
2957+
if sys.platform == "emscripten":
2958+
# Emscripten will return ELOOP if there are 49 or more ..'s.
2959+
# Can remove when https://github.com/emscripten-core/emscripten/pull/24591 is merged.
2960+
NDOTDOTS = 48
2961+
else:
2962+
NDOTDOTS = 50
2963+
self.assertEqual(set(p.glob("/".join([".."] * NDOTDOTS))), { P(self.base, *[".."] * NDOTDOTS)})
29582964

29592965
def test_glob_inaccessible(self):
29602966
P = self.cls

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy