diff options
author | qmuntal <quimmuntal@gmail.com> | 2024-02-28 16:06:04 +0100 |
---|---|---|
committer | Quim Muntal <quimmuntal@gmail.com> | 2024-03-04 18:59:50 +0000 |
commit | 7986e26a39e9df870886a9933107372f4e16ea4c (patch) | |
tree | dcda4d454d0487d63d6a4902042aaf71751fd9ba /doc | |
parent | 90796f44d5d10163196c6116ae667eddba8b06c0 (diff) | |
download | go-7986e26a39e9df870886a9933107372f4e16ea4c.tar.gz go-7986e26a39e9df870886a9933107372f4e16ea4c.zip |
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>
Diffstat (limited to 'doc')
-rw-r--r-- | doc/godebug.md | 13 | ||||
-rw-r--r-- | doc/next/6-stdlib/99-minor/os/61893.md | 7 | ||||
-rw-r--r-- | doc/next/6-stdlib/99-minor/path/filepath/63703.md | 5 |
3 files changed, 25 insertions, 0 deletions
diff --git a/doc/godebug.md b/doc/godebug.md index 184bae4932..83b4bda89a 100644 --- a/doc/godebug.md +++ b/doc/godebug.md @@ -126,6 +126,19 @@ for example, see the [runtime documentation](/pkg/runtime#hdr-Environment_Variables) and the [go command documentation](/cmd/go#hdr-Build_and_test_caching). +### Go 1.23 + +Go 1.23 changed the mode bits reported by [`os.Lstat`](/pkg/os#Lstat) and [`os.Stat`](/pkg/os#Stat) +for reparse points, which can be controlled with the `winsymlink` setting. +As of Go 1.23 (`winsymlink=1`), mount points no longer have [`os.ModeSymlink`](/pkg/os#ModeSymlink) +set, and reparse points that are not symlinks, Unix sockets, or dedup files now +always have [`os.ModeIrregular`](/pkg/os#ModeIrregular) set. As a result of these changes, +[`filepath.EvalSymlinks`](/pkg/path/filepath#EvalSymlinks) no longer evaluates +mount points, which was a source of many inconsistencies and bugs. +At previous versions (`winsymlink=0`), mount points are treated as symlinks, +and other reparse points with non-default [`os.ModeType`](/pkg/os#ModeType) bits +(such as [`os.ModeDir`](/pkg/os#ModeDir)) do not have the `ModeIrregular` bit set. + ### Go 1.22 Go 1.22 adds a configurable limit to control the maximum acceptable RSA key size diff --git a/doc/next/6-stdlib/99-minor/os/61893.md b/doc/next/6-stdlib/99-minor/os/61893.md new file mode 100644 index 0000000000..b2dd537039 --- /dev/null +++ b/doc/next/6-stdlib/99-minor/os/61893.md @@ -0,0 +1,7 @@ +On Windows, the mode bits reported by [`os.Lstat`](/pkg/os#Lstat) and [`os.Stat`](/pkg/os#Stat) +for reparse points changed. Mount points no longer have [`os.ModeSymlink`](/pkg/os#ModeSymlink) set, +and reparse points that are not symlinks, Unix sockets, or dedup files now +always have [`os.ModeIrregular`](/pkg/os#ModeIrregular) set. +This behavior is controlled by the `winsymlink` setting. +For Go 1.23, it defaults to `winsymlink=1`. +Previous versions default to `winsymlink=0`. diff --git a/doc/next/6-stdlib/99-minor/path/filepath/63703.md b/doc/next/6-stdlib/99-minor/path/filepath/63703.md new file mode 100644 index 0000000000..f5dc76c46a --- /dev/null +++ b/doc/next/6-stdlib/99-minor/path/filepath/63703.md @@ -0,0 +1,5 @@ +On Windows, [`filepath.EvalSymlinks`](/pkg/path/filepath#EvalSymlinks) no longer evaluates +mount points, which was a source of many inconsistencies and bugs. +This behavior is controlled by the `winsymlink` setting. +For Go 1.23, it defaults to `winsymlink=1`. +Previous versions default to `winsymlink=0`. |