Issue 36621: shutil.rmtree follows junctions on windows (original) (raw)

Issue36621

Created on 2019-04-12 20:35 by Jordan Hueckstaedt, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Messages (3)
msg340111 - (view) Author: Jordan Hueckstaedt (Jordan Hueckstaedt) Date: 2019-04-12 20:35
shutil.rmtree follows junctions / reparse points on windows and will delete files in the target link directory.
msg396158 - (view) Author: Irit Katriel (iritkatriel) * (Python committer) Date: 2021-06-20 00:14
The documentation for rmtree[1] now says: Changed in version 3.8: On Windows, will no longer delete the contents of a directory junction before removing the junction. So I think this issue can be closed. [1] https://docs.python.org/3/library/shutil.html#shutil.rmtree
msg396163 - (view) Author: Eryk Sun (eryksun) * (Python triager) Date: 2021-06-20 06:34
Yes, this issue is out of date. shutil._rmtree_isdir() and shutil._rmtree_islink() were added to handle mount points (i.e. junctions) as if they're symlinks. More generally, junctions and symlinks are what the platform refers to as name-surrogate reparse points. This category isn't handled generically by rmtree(). It wouldn't be hard to generalize the implementation, but that's something for a new issue.
History
Date User Action Args
2022-04-11 14:59:13 admin set github: 80802
2021-06-20 06:34:47 eryksun set status: pending -> closednosy: + eryksunmessages: + stage: resolved
2021-06-20 00:14:45 iritkatriel set status: open -> pendingnosy: + iritkatrielmessages: + resolution: out of date
2019-04-12 20:35:45 Jordan Hueckstaedt create