Repository navigation
Python test suite (test_ntpath?) tries to removes system directories in the volume root directory ("System Volume Information") #156707
Copy link
Copy link
Closed
Labels
Description
A test creating testjunc junction on Windows (test_ntpath?) tries to remove system directories such as "\System Volume Information".
AMD64 Windows11 Non-Debug 3.14: https://buildbot.python.org/#/builders/1684/builds/823
Warning -- regrtest worker thread failed: Traceback (most recent call last):
Warning -- File "b:\uildarea\3.14.ware-win11.nondebug\build\Lib\test\support\__init__.py", line 211, in _force_run
Warning -- return func(*args)
Warning -- PermissionError: [WinError 5] Access is denied: 'b:\\uildworker_temp\\test_python_f3pmns6d\\tmpfeb_loxl\\testjunc\\System Volume Information'
Warning --
Warning -- During handling of the above exception, another exception occurred:
Warning --
Warning -- Traceback (most recent call last):
Warning -- File "b:\uildarea\3.14.ware-win11.nondebug\build\Lib\test\libregrtest\run_workers.py", line 407, in run
Warning -- mp_result = self._runtest(test_name)
Warning -- File "b:\uildarea\3.14.ware-win11.nondebug\build\Lib\test\libregrtest\run_workers.py", line 366, in _runtest
Warning -- retcode, tmp_files = self.run_tmp_files(worker_runtests,
Warning -- ~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
Warning -- stdout_file.fileno())
Warning -- ^^^^^^^^^^^^^^^^^^^^^
Warning -- File "b:\uildarea\3.14.ware-win11.nondebug\build\Lib\test\libregrtest\run_workers.py", line 306, in run_tmp_files
Warning -- os_helper.rmtree(tmp_dir)
Warning -- ~~~~~~~~~~~~~~~~^^^^^^^^^
Warning -- File "b:\uildarea\3.14.ware-win11.nondebug\build\Lib\test\support\os_helper.py", line 508, in rmtree
Warning -- _rmtree(path)
Warning -- ~~~~~~~^^^^^^
Warning -- File "b:\uildarea\3.14.ware-win11.nondebug\build\Lib\test\support\os_helper.py", line 440, in _rmtree
Warning -- _waitfor(_rmtree_inner, path, waitall=True)
Warning -- ~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Warning -- File "b:\uildarea\3.14.ware-win11.nondebug\build\Lib\test\support\os_helper.py", line 381, in _waitfor
Warning -- func(pathname)
Warning -- ~~~~^^^^^^^^^^
Warning -- File "b:\uildarea\3.14.ware-win11.nondebug\build\Lib\test\support\os_helper.py", line 436, in _rmtree_inner
Warning -- _waitfor(_rmtree_inner, fullname, waitall=True)
Warning -- ~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Warning -- File "b:\uildarea\3.14.ware-win11.nondebug\build\Lib\test\support\os_helper.py", line 381, in _waitfor
Warning -- func(pathname)
Warning -- ~~~~^^^^^^^^^^
Warning -- File "b:\uildarea\3.14.ware-win11.nondebug\build\Lib\test\support\os_helper.py", line 436, in _rmtree_inner
Warning -- _waitfor(_rmtree_inner, fullname, waitall=True)
Warning -- ~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Warning -- File "b:\uildarea\3.14.ware-win11.nondebug\build\Lib\test\support\os_helper.py", line 381, in _waitfor
Warning -- func(pathname)
Warning -- ~~~~^^^^^^^^^^
Warning -- File "b:\uildarea\3.14.ware-win11.nondebug\build\Lib\test\support\os_helper.py", line 436, in _rmtree_inner
Warning -- _waitfor(_rmtree_inner, fullname, waitall=True)
Warning -- ~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Warning -- File "b:\uildarea\3.14.ware-win11.nondebug\build\Lib\test\support\os_helper.py", line 381, in _waitfor
Warning -- func(pathname)
Warning -- ~~~~^^^^^^^^^^
Warning -- File "b:\uildarea\3.14.ware-win11.nondebug\build\Lib\test\support\os_helper.py", line 426, in _rmtree_inner
Warning -- for name in _force_run(path, os.listdir, path):
Warning -- ~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^
Warning -- File "b:\uildarea\3.14.ware-win11.nondebug\build\Lib\test\support\__init__.py", line 221, in _force_run
Warning -- os.chmod(path, stat.S_IRWXU)
Warning -- ~~~~~~~~^^^^^^^^^^^^^^^^^^^^
Warning -- PermissionError: [WinError 5] Access is denied: 'b:\\uildworker_temp\\test_python_f3pmns6d\\tmpfeb_loxl\\testjunc\\System Volume Information'
Linked PRs
- gh-156707: Remove the junction created in test_realpath_volume_guid_path() #156709
- gh-156707: Do not follow junctions in os_helper.rmtree() on Windows #156710
- [3.15] gh-156707: Do not follow junctions in os_helper.rmtree() on Windows (GH-156710) #156714
- [3.14] gh-156707: Do not follow junctions in os_helper.rmtree() on Windows (GH-156710) #156715
- [3.13] gh-156707: Do not follow junctions in os_helper.rmtree() on Windows (GH-156710) #156716
Reactions are currently unavailable
Activity
vstinner commentedon Aug 31, 2026
Another example trying to remove
$WINRE_BACKUP_PARTITION.MARKERmarker file.AMD64 Windows Server 2025 Refleaks 3.13: https://buildbot.python.org/#/builders/2266/builds/92
vstinner commentedon Aug 31, 2026
@serhiy-storchaka @encukou: I suspect that it's a regression introduced by
test_realpath_volume_guid_path()oftest_ntpath, related to issue gh-89760.serhiy-storchaka commentedon Aug 31, 2026
Yes, this was my error. Thank you for catching it @vstinner.
Two solutions:
os_helper.rmtree()on Windows. This can help in future tests, and it can be backported independently from the new test. It seems thatshutil.rmtree()andTemporaryDirectoryalready handle junctions correctly.Any one of them fixes the issue, but it is better to apply both.
pythongh-156707: Remove the junction created in test_realpath_volume_…
gh-156707: Do not follow junctions in os_helper.rmtree() on Windows (G…
[3.13] gh-156707: Do not follow junctions in os_helper.rmtree() on Wi…
[3.14] gh-156707: Do not follow junctions in os_helper.rmtree() on Wi…
[3.15] gh-156707: Do not follow junctions in os_helper.rmtree() on Wi…
pythongh-156707: Do not follow junctions in os_helper.rmtree() on Win…
[3.15] gh-89760: Fix os.path.realpath() for volume GUID paths on Wind…