From 7bb721b9384bdd196befeaed593b185f7f2a5589 Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Tue, 7 Jul 2020 13:49:21 -0400 Subject: all: update references to symbols moved from os to io/fs The old os references are still valid, but update our code to reflect best practices and get used to the new locations. Code compiled with the bootstrap toolchain (cmd/asm, cmd/dist, cmd/compile, debug/elf) must remain Go 1.4-compatible and is excluded. For #41190. Change-Id: I8f9526977867c10a221e2f392f78d7dec073f1bd Reviewed-on: https://go-review.googlesource.com/c/go/+/243907 Trust: Russ Cox Run-TryBot: Russ Cox TryBot-Result: Go Bot Reviewed-by: Rob Pike --- src/path/filepath/path_windows_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (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 f7c454bf65..990f18614d 100644 --- a/src/path/filepath/path_windows_test.go +++ b/src/path/filepath/path_windows_test.go @@ -8,6 +8,7 @@ import ( "flag" "fmt" "internal/testenv" + "io/fs" "io/ioutil" "os" "os/exec" @@ -34,7 +35,7 @@ func testWinSplitListTestIsValid(t *testing.T, ti int, tt SplitListTest, const ( cmdfile = `printdir.cmd` - perm os.FileMode = 0700 + perm fs.FileMode = 0700 ) tmp, err := ioutil.TempDir("", "testWinSplitListTestIsValid") -- cgit v1.2.1 From 94887410d41eb29ea4f2354e80a6aae4ee602fcf Mon Sep 17 00:00:00 2001 From: Kevin Parsons Date: Tue, 20 Oct 2020 15:15:23 +0000 Subject: path/filepath: allow EvalSymlinks to work on UNC share roots on Windows Fixes #42079 Previously, EvalSymlinks returned an error when called with the root of a UNC share (e.g. \\server\share). This was due to Windows's FindFirstFile function not supporting a share root path. To resolve this, now return early from toNorm in the case where the path after the volume name is empty. Skipping the later path component resolution shouldn't have any negative impact in this case, as if the path is empty, there aren't any path components to resolve anyways. The test case uses the localhost admin share (c$), as it should be present in most situations. This allows testing without setting up an external file share. However, this fix applies to all UNC share root paths. Change-Id: I05035bd86be93662d7bea34fab4b75fc8e918206 GitHub-Last-Rev: bd3db2cda65aae1cdf8d94b03bc7197dff68dc44 GitHub-Pull-Request: golang/go#42096 Reviewed-on: https://go-review.googlesource.com/c/go/+/263917 Trust: Alex Brainman Trust: Giovanni Bajo Run-TryBot: Alex Brainman Reviewed-by: Alex Brainman --- src/path/filepath/path_windows_test.go | 3 +++ 1 file changed, 3 insertions(+) (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 990f18614d..9309a7dc4d 100644 --- a/src/path/filepath/path_windows_test.go +++ b/src/path/filepath/path_windows_test.go @@ -413,6 +413,9 @@ func TestToNorm(t *testing.T) { {`{{tmp}}\test`, `.\foo\bar`, `foo\bar`}, {`{{tmp}}\test`, `foo\..\foo\bar`, `foo\bar`}, {`{{tmp}}\test`, `FOO\BAR`, `foo\bar`}, + + // test UNC paths + {".", `\\localhost\c$`, `\\localhost\c$`}, } tmp, err := ioutil.TempDir("", "testToNorm") -- cgit v1.2.1