Skip to content

path/filepath: EvalSymlinks fails when specifying symbolic links under /tmp on macOS  #57905

@matsuyoshi30

Description

@matsuyoshi30

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

$ go version
go version go1.19.5 darwin/amd64

Does this issue reproduce with the latest release?

Yes

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

go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/matsuyoshi/Library/Caches/go-build"
GOENV="/Users/matsuyoshi/Library/Application Support/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/matsuyoshi/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/matsuyoshi/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GOVCS=""
GOVERSION="go1.19.5"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/matsuyoshi/tmp/go.mod"
GOWORK=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -arch x86_64 -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/y_/5qxlxmyd4bs7mps83j1rhcpr0000gn/T/go-build1061963943=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

% pwd
/Users/matsuyoshi/tmp
% ls -l dst
lrwxr-xr-x  1 matsuyoshi  staff  8  1 19 00:28 dst@ -> /tmp/src
% cat main.go
package main

import (
        "fmt"
        "path/filepath"
)

func main() {
	v, err := filepath.EvalSymlinks("dst")
	fmt.Println(v)
	fmt.Println(err)
}
% go run main.go

What did you expect to see?

/private/tmp/src

What did you see instead?

lstat private: no such file or directory

On macOS, /tmp is a symbolic link to private/tmp, but I think filepath.EvalSymlinks doesn't handle this case when traversing symbolic links.

Metadata

Metadata

Labels

FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions