Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

os: Symlink creates wrong symlink type (file symlink instead of directory symlink) #28432

Closed
alexbrainman opened this issue Oct 27, 2018 · 1 comment
Milestone

Comments

@alexbrainman
Copy link
Member

@alexbrainman alexbrainman commented Oct 27, 2018

What version of Go are you using (go version)?

go version devel +5bc1fd4 Fri Oct 26 20:47:01 2018 +0000 windows/amd64

Does this issue reproduce with the latest release?

It does.

What operating system and processor architecture are you using (go env)?

set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\Alex\AppData\Local\go-build
set GOEXE=.exe
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOOS=windows
set GOPATH=c:\users\alex\dev
set GOPROXY=
set GORACE=
set GOROOT=c:\users\alex\dev\go
set GOTMPDIR=
set GOTOOLDIR=c:\users\alex\dev\go\pkg\tool\windows_amd64
set GCCGO=gccgo
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set GOMOD=
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 -fmessage-length=0 -fdebug-prefix-map=C:\Users\Alex\AppData\Local\Temp\go-build402194526=/tmp/go-build -gno-record-gcc-switches

What did you do?

I run go test command against this program https://play.golang.org/p/7p-1wyayalB

What did you expect to see?

I expected test to pass.

What did you see instead?

Test fails with this message:

=== RUN   TestSymlink
--- FAIL: TestSymlink (0.01s)
    main_test.go:13: open C:\Users\Alex\AppData\Local\Temp\TestSymlink767020227\linklink: Access is denied.

Interestingly, that is what TMP directory look like during the test:

 Directory of C:\Users\Alex\AppData\Local\Temp\TestSymlink767020227

27/10/2018  02:54 PM    <DIR>          .
27/10/2018  02:54 PM    <DIR>          ..
27/10/2018  02:54 PM    <DIR>          dir
27/10/2018  02:54 PM    <SYMLINKD>     link [C:\Users\Alex\AppData\Local\Temp\TestSymlink767020227\dir]
27/10/2018  02:54 PM    <SYMLINK>      linklink [C:\Users\Alex\AppData\Local\Temp\TestSymlink767020227\link]
               1 File(s)              0 bytes

Note how link is a symlink to a directory (see SYMLINKD), while linklink is a symlink to a file (see SYMLINK).

Alex

@gopherbot

This comment has been minimized.

Copy link

@gopherbot gopherbot commented Oct 27, 2018

Change https://golang.org/cl/145217 mentions this issue: os: use Stat instead of Lstat in Symlink

@katiehockman katiehockman added this to the Go1.12 milestone Oct 29, 2018
@gopherbot gopherbot closed this in 5cc8089 Oct 31, 2018
@golang golang locked and limited conversation to collaborators Oct 31, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.