diff options
author | qmuntal <quimmuntal@gmail.com> | 2024-02-28 16:07:27 +0100 |
---|---|---|
committer | Quim Muntal <quimmuntal@gmail.com> | 2024-03-04 20:38:54 +0000 |
commit | b09ac10badb169828240a3b0bfaa4a428eaca969 (patch) | |
tree | 254dbf7873244b6989775b506b2d57748ad3c52f /src/path | |
parent | 2b22fc10459dff0fb4b3e5b08bc14ffb349aa4dd (diff) | |
download | go-b09ac10badb169828240a3b0bfaa4a428eaca969.tar.gz go-b09ac10badb169828240a3b0bfaa4a428eaca969.zip |
os: don't normalize volumes to drive letters in os.Readlink
This CL updates os.Readlink so it no longer tries to normalize volumes
to drive letters, which was not always even possible.
This behavior is controlled by the `winreadlinkvolume` setting.
For Go 1.23, it defaults to `winreadlinkvolume=1`.
Previous versions default to `winreadlinkvolume=0`.
Fixes #63703.
Cq-Include-Trybots: luci.golang.try:gotip-windows-amd64-longtest,gotip-windows-arm64
Change-Id: Icd6fabbc8f0b78e23a82eef8db89940e89e9222d
Reviewed-on: https://go-review.googlesource.com/c/go/+/567735
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Diffstat (limited to 'src/path')
-rw-r--r-- | src/path/filepath/path_windows_test.go | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/path/filepath/path_windows_test.go b/src/path/filepath/path_windows_test.go index 524b0d0f92..2862f390d0 100644 --- a/src/path/filepath/path_windows_test.go +++ b/src/path/filepath/path_windows_test.go @@ -530,6 +530,7 @@ func createMountPartition(t *testing.T, vhd string, args string) []byte { } var winsymlink = godebug.New("winsymlink") +var winreadlinkvolume = godebug.New("winreadlinkvolume") func TestEvalSymlinksJunctionToVolumeID(t *testing.T) { // Test that EvalSymlinks resolves a directory junction which @@ -617,7 +618,11 @@ func TestNTNamespaceSymlink(t *testing.T) { } var want string if winsymlink.Value() == "0" { - want = vol + `\` + if winreadlinkvolume.Value() == "0" { + want = vol + `\` + } else { + want = target + } } else { want = dirlink } @@ -646,7 +651,12 @@ func TestNTNamespaceSymlink(t *testing.T) { if err != nil { t.Fatal(err) } - want = file + + if winreadlinkvolume.Value() == "0" { + want = file + } else { + want = target + } if got != want { t.Errorf(`EvalSymlinks(%q): got %q, want %q`, filelink, got, want) } |