Skip to content

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

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
matsuyoshi30 opened this issue Jan 18, 2023 · 1 comment
Assignees
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@matsuyoshi30
Copy link
Contributor

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.

@gopherbot
Copy link
Contributor

Change https://go.dev/cl/461761 mentions this issue: path/filepath: EvalSymlinks handles symbolic links under /tmp on macOS

@bcmills bcmills added the NeedsFix The path to resolution is known, but the work has not been done. label Jan 18, 2023
@bcmills bcmills added this to the Go1.21 milestone Jan 18, 2023
@golang golang locked and limited conversation to collaborators Jan 20, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

3 participants