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

Daniel Kahn Gillmor report at bugs.python.org
Thu Mar 2 14:13:29 EST 2017


Daniel Kahn Gillmor added the comment:

and here is python demonstration script that will build breaker.c and then use it to cause the error to be raised from shutils.rmtree.

the output of demo.py looks like this:

make: 'breaker' is up to date.
Traceback (most recent call last):
  File "./demo.py", line 14, in <module>
    shutil.rmtree('xx')
  File "/usr/lib/python3.5/shutil.py", line 480, in rmtree
    _rmtree_safe_fd(fd, path, onerror)
  File "/usr/lib/python3.5/shutil.py", line 438, in _rmtree_safe_fd
    onerror(os.unlink, fullname, sys.exc_info())
  File "/usr/lib/python3.5/shutil.py", line 436, in _rmtree_safe_fd
    os.unlink(name, dir_fd=topfd)
FileNotFoundError: [Errno 2] No such file or directory: 'b'

----------
Added file: http://bugs.python.org/file46688/demo.py

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


More information about the Python-bugs-list mailing list