]> Cypherpunks repositories - gostls13.git/commit
os: avoid symlink races in RemoveAll on Windows
authorDamien Neil <dneil@google.com>
Fri, 28 Mar 2025 23:14:43 +0000 (16:14 -0700)
committerGopher Robot <gobot@golang.org>
Mon, 31 Mar 2025 22:36:10 +0000 (15:36 -0700)
commit6d418096b2dfe2a2e47b7aa83b46748fb301e6cb
treed7740233a1d75c56e4aef697da8241396946dc43
parentc6a1dc47297a47e6111e3a00911393c355800023
os: avoid symlink races in RemoveAll on Windows

Make the openat-using version of RemoveAll use the appropriate
Windows equivalent, via new portable (but internal) functions
added for os.Root.

We could reimplement everything in terms of os.Root,
but this is a bit simpler and keeps the existing code structure.

Fixes #52745

Change-Id: I0eba0286398b351f2ee9abaa60e1675173988787
Reviewed-on: https://go-review.googlesource.com/c/go/+/661575
Reviewed-by: Alan Donovan <adonovan@google.com>
Auto-Submit: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
src/internal/syscall/unix/constants.go
src/internal/syscall/unix/nofollow_posix.go
src/internal/syscall/windows/at_windows.go
src/os/path_windows.go
src/os/removeall_at.go
src/os/removeall_noat.go
src/os/removeall_unix.go [new file with mode: 0644]
src/os/removeall_windows.go [new file with mode: 0644]
src/os/root_unix.go
src/os/root_windows.go