-
Notifications
You must be signed in to change notification settings - Fork 18.3k
Description
What version of Go are you using (go version
)?
go version go1.9.2 windows/amd64
and go version go1.10beta2 windows/amd64
.
Does this issue reproduce with the latest release?
Yes, this is reproducable with go 1.10beta2
and 1.9.2
What operating system and processor architecture are you using (go env
)?
set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\ContainerAdministrator\AppData\Local\go-build
set GOEXE=.exe
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOOS=windows
set GOPATH=C:\gopath
set GORACE=
set GOROOT=C:\go
set GOTMPDIR=
set GOTOOLDIR=C:\go\pkg\tool\windows_amd64
set GCCGO=gccgo
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -mthreads -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=C:\Users\ContainerAdministrator\AppData\Local\Temp\go-build022882258
=/tmp/go-build -gno-record-gcc-switches
What did you do?
Running filepath.EvalSymlinks
against a bind mounted directory within a windows container (for example, \\?\ContainerMappedDirectories\D48AFB19-F38F-4DAE-A698-4D718D506B15
) returns the following error:
PS C:\Users\Administrator> docker run --rm -v c:\:c:\host golang:1.10-rc-nanoserver-sac2016 go run c:\host\eval_symlinks.go
panic: GetFileAttributesEx \ContainerMappedDirectories: The system cannot find the file specified.
goroutine 1 [running]:
main.main()
c:/host/eval_symlinks.go:11 +0xe6
exit status 2
eval_symlinks.go
above is the following program:
package main
import (
"fmt"
"path/filepath"
)
func main() {
path, err := filepath.EvalSymlinks("c:\\host")
if err != nil {
panic(err)
}
fmt.Printf("eval path: %s\n", path)
}
Note that the symlink is valid. For example, I can cd
to it:
PS C:\gopath> cmd /c dir c:\
Volume in drive C has no label.
Volume Serial Number is 8E1D-692C
Directory of c:\
01/22/2018 01:34 PM <DIR> go
01/08/2018 10:34 AM <DIR> gopath
01/22/2018 01:34 PM <SYMLINKD> host [\\?\ContainerMappedDirectories\007C5A5F-50A3-4019-BCF1-1BA20F4745
11/20/2016 03:32 AM 1,894 License.txt
01/22/2018 01:34 PM <DIR> Program Files
07/16/2016 04:09 AM <DIR> Program Files (x86)
01/22/2018 01:34 PM <DIR> Users
01/22/2018 01:34 PM <DIR> Windows
1 File(s) 1,894 bytes
7 Dir(s) 21,256,376,320 bytes free
PS C:\gopath> cd \\?\ContainerMappedDirectories\007C5A5F-50A3-4019-BCF1-1BA20F4745F4
PS Microsoft.PowerShell.Core\FileSystem::\\?\ContainerMappedDirectories\007C5A5F-50A3-4019-BCF1-1BA20F4745F4>
golang 1.9.2 returns the same error:
PS C:\Users\Administrator> docker run --rm -v c:\:c:\host golang:1.9.2-nanoserver-sac2016 go run c:\host\eval_symlinks.go
panic: GetFileAttributesEx \ContainerMappedDirectories: The system cannot find the file specified.
goroutine 1 [running]:
main.main()
c:/host/eval_symlinks.go:11 +0xfe
exit status 2
I see that EvalSymlinks on Windows was reimplemented recently (66c03d3), maybe there was a nuance wrt the \\?\
path style that was missed?
What did you expect to see?
I expected filepath.EvalSymlinks
to return the original directory (C:\host
) or the directory that was linked to (\\?\ContainerMappedDirectories\007C5A5F-50A3-4019-BCF1-1BA20F4745
).
What did you see instead?
The error GetFileAttributesEx \ContainerMappedDirectories: The system cannot find the file specified
.