Skip to content

path/filepath: windows: EvalSymlinks produces incorrect results when called with "." inside a symlink #12451

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

Closed
alexsaveliev opened this issue Sep 2, 2015 · 1 comment

Comments

@alexsaveliev
Copy link

reproducible with

go version go1.4.2 windows/amd64
go version go1.5 windows/amd64

OS

Windows 7 Home Premium x64

How to repeat

  • create directory and two symlinks to it, one is relative and one points to absolute path
C:\>mkdir c:\a
C:\>mklink  /D b a
symbolic link created for b <<===>> a
C:\>mklink  /D c C:\a
symbolic link created for c <<===>> C:\a
  • In each of a, b, c run the following code
package main

import (
    "os"
    "path/filepath"
    "fmt"
)

func main() {

    source := os.Args[1]
    target, err := filepath.EvalSymlinks(source)
    fmt.Println(target, err)
}

passing . as argument

Expected result:

C:\a>go run D:\test\checklink.go .
. <nil>

C:\b>go run D:\test\checklink.go .
. <nil>

C:\c>go run D:\test\checklink.go .
. <nil>

Actual result:

C:\a>go run D:\test\checklink.go .
. <nil>

C:\b>go run D:\test\checklink.go .
go build command-line-arguments: C:\Go\pkg\tool\windows_amd64\6l.exe: chdir a: The system cannot find the file specified.

C:\c>go run D:\test\checklink.go .
 EvalSymlinks: too many links in .
@ianlancetaylor ianlancetaylor added this to the Go1.6 milestone Sep 2, 2015
@ianlancetaylor ianlancetaylor changed the title windows: path/filepath.EvalSymlinks produces incorrect results when called with "." inside a symlink path/filepath: windows: EvalSymlinks produces incorrect results when called with "." inside a symlink Sep 2, 2015
@gopherbot
Copy link
Contributor

CL https://golang.org/cl/16192 mentions this issue.

@golang golang locked and limited conversation to collaborators Nov 4, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants