Removing the ownership marker last protects a removal that stops while clearing a tree's contents. It does not protect one that fails on the directory itself.
In bootstrap.sh remove_tree and bootstrap.ps1 Remove-Tree, the final rm -rf "$1" or Remove-Item -Recurse deletes .bootstrap-owned and then fails on the now-empty directory. That leaves an unmarked, empty directory at a managed name.
- Triggers: a parent directory that is not writable. On Windows, likely also a directory that is some process's working directory (inferred, not run there).
- Consequence: every later run refuses the leftover with "exists and this loader did not create it ... Choose another --dir". The PowerShell warnings saying "a later run removes it once nothing holds a file in it" are then wrong.
- Fix direction: treat an empty directory at a managed name as removable, since it holds nothing to lose, or rename the tree aside under a marker-carrying name before the final removal.
Not a regression: the plain rm -rf this replaced had the same final-step behavior, and it also lost the marker on a partial removal. Found by the local strict review on #1794. Related: #1790.
Removing the ownership marker last protects a removal that stops while clearing a tree's contents. It does not protect one that fails on the directory itself.
In
bootstrap.shremove_treeandbootstrap.ps1Remove-Tree, the finalrm -rf "$1"orRemove-Item -Recursedeletes.bootstrap-ownedand then fails on the now-empty directory. That leaves an unmarked, empty directory at a managed name.Not a regression: the plain
rm -rfthis replaced had the same final-step behavior, and it also lost the marker on a partial removal. Found by the local strict review on #1794. Related: #1790.