mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 05:31:20 +00:00 
			
		
		
		
	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.
This commit is contained in:
		
							parent
							
								
									ce58afb400
								
							
						
					
					
						commit
						e4ccd46bf7
					
				
					 1 changed files with 7 additions and 1 deletions
				
			
		|  | @ -2954,7 +2954,13 @@ def test_glob_dotdot(self): | |||
|         else: | ||||
|             # ".." segments are normalized first on Windows, so this path is stat()able. | ||||
|             self.assertEqual(set(p.glob("xyzzy/..")), { P(self.base, "xyzzy", "..") }) | ||||
|         self.assertEqual(set(p.glob("/".join([".."] * 50))), { P(self.base, *[".."] * 50)}) | ||||
|         if sys.platform == "emscripten": | ||||
|             # Emscripten will return ELOOP if there are 49 or more ..'s. | ||||
|             # Can remove when https://github.com/emscripten-core/emscripten/pull/24591 is merged. | ||||
|             NDOTDOTS = 48 | ||||
|         else: | ||||
|             NDOTDOTS = 50 | ||||
|         self.assertEqual(set(p.glob("/".join([".."] * NDOTDOTS))), { P(self.base, *[".."] * NDOTDOTS)}) | ||||
| 
 | ||||
|     def test_glob_inaccessible(self): | ||||
|         P = self.cls | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Hood Chatham
						Hood Chatham