]> Cypherpunks repositories - gostls13.git/commit
os: don't treat mount points as symbolic links
authorqmuntal <quimmuntal@gmail.com>
Wed, 28 Feb 2024 15:06:04 +0000 (16:06 +0100)
committerQuim Muntal <quimmuntal@gmail.com>
Mon, 4 Mar 2024 18:59:50 +0000 (18:59 +0000)
commit7986e26a39e9df870886a9933107372f4e16ea4c
treedcda4d454d0487d63d6a4902042aaf71751fd9ba
parent90796f44d5d10163196c6116ae667eddba8b06c0
os: don't treat mount points as symbolic links

This CL changes the behavior of os.Lstat to stop setting the
os.ModeSymlink type mode bit for mount points on Windows. As a result,
filepath.EvalSymlinks no longer evaluates mount points, which was the
cause of many inconsistencies and bugs.

Additionally, os.Lstat starts setting the os.ModeIrregular type mode bit
for all reparse tags on Windows, except for those that are explicitly
supported by the os package, which, since this CL, doesn't include mount
points. This helps to identify files that need special handling outside
of the os package.

This behavior is controlled by the `winsymlink` GODEBUG setting.
For Go 1.23, it defaults to `winsymlink=1`.
Previous versions default to `winsymlink=0`.

Fixes #39786
Fixes #40176
Fixes #61893
Updates #63703
Updates #40180
Updates #63429

Cq-Include-Trybots: luci.golang.try:gotip-windows-amd64-longtest,gotip-windows-arm64
Change-Id: I2e7372ab8862f5062667d30db6958d972bce5407
Reviewed-on: https://go-review.googlesource.com/c/go/+/565136
Reviewed-by: Bryan Mills <bcmills@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
doc/godebug.md
doc/next/6-stdlib/99-minor/os/61893.md [new file with mode: 0644]
doc/next/6-stdlib/99-minor/path/filepath/63703.md [new file with mode: 0644]
src/internal/godebugs/table.go
src/os/os_windows_test.go
src/os/types_windows.go
src/path/filepath/path_test.go
src/path/filepath/path_windows_test.go
src/runtime/metrics/doc.go