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

Jeffrey Kintscher report at bugs.python.org
Sun May 26 00:05:51 EDT 2019


Jeffrey Kintscher <websurfer at surf2c.net> added the comment:

I created pull request bpo-29699 to fix this issue. It adds an additional exception handler to ignore FileNotFoundError for most of the try blocks that already handle OSError.

I decided not to add it to the initial os.open() call. This should provide the same semantics as the "rm -r" shell command. It will fail with FileNotFoundError when foo is missing, which is the same behavior as "rm -r foo" returning "rm: foo: No such file or directory" when foo is missing. Similarly, "rm -rf foo" always succeeds and is equivalent to setting "ignore_errors=true" in the shutil.rmtree() call.

----------

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


More information about the Python-bugs-list mailing list