From b09ac10badb169828240a3b0bfaa4a428eaca969 Mon Sep 17 00:00:00 2001 From: qmuntal Date: Wed, 28 Feb 2024 16:07:27 +0100 Subject: 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 Reviewed-by: Bryan Mills LUCI-TryBot-Result: Go LUCI --- src/path/filepath/path_windows_test.go | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'src/path/filepath/path_windows_test.go') 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) } -- cgit v1.3-6-g1900