[issue29699] shutil.rmtree should not fail with FileNotFoundError (race condition)

coroa report at bugs.python.org
Tue Dec 14 16:57:38 EST 2021


coroa <coroa at posteo.de> added the comment:

Just realised that the "race condition" is triggered consistently on Mac OSX machines working on non-Mac filesystems, where they store extended attributes like last access time in meta files with a `._` prefix. These files are listed by `os.scandir` after their original files and are removed, as soon as the original file is unlinked.

Ie. a test.txt, ._test.txt pair will always raise FileNotFoundError for ._test.txt since the file system driver itself already removed it when the unlink on test.txt was executed.

Refer also to https://stackoverflow.com/a/70355470/2873952.

Current status seems to be:
1. https://bugs.python.org/issue29699 and https://bugs.python.org/issue37260 are duplicates.
2. https://github.com/python/cpython/pull/13580 linked from here has been closed due to lack of unit tests (but with the possibility to re-open after providing those)
3. https://github.com/python/cpython/pull/14064 is still open and seems to be mostly the same patch, does have unit tests and awaiting a second review.

What is the next step?

----------
nosy: +coroa
versions:  -Python 3.5

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue29699>
_______________________________________


More information about the Python-bugs-list mailing list