Message345445
shutil.rmtree() is susceptible to a race condition that can needlessly raise OSError:
1. os.scandir() returns the list of entries in a directory
2. while iterating over the list, another thread or process deletes one or more of the entries not yet iterated
3. os.unlink() or stat() raises OSError for the already deleted entry
It should check for and ignore, at a minimum, FileNotFoundError because we were going to delete the entry anyways. For comparison, the 'rm -r' shell command handles this race condition by ignoring entries deleted from under it.
I will submit a PR when I work out some test cases to include. |
|
Date |
User |
Action |
Args |
2019-06-13 01:10:41 | Jeffrey.Kintscher | set | recipients:
+ Jeffrey.Kintscher, giampaolo.rodola, tarek |
2019-06-13 01:10:41 | Jeffrey.Kintscher | set | messageid: <1560388241.37.0.285109327745.issue37260@roundup.psfhosted.org> |
2019-06-13 01:10:41 | Jeffrey.Kintscher | link | issue37260 messages |
2019-06-13 01:10:41 | Jeffrey.Kintscher | create | |
|