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

path/filepath: WalkDir pass unclean path to WalkDirFunc while using unclean root #50629

Open
auxten opened this issue Jan 15, 2022 · 1 comment
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@auxten
Copy link

auxten commented Jan 15, 2022

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

$ go version
go version go1.18beta1 darwin/arm64

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="arm64"
GOBIN=""
GOCACHE="/Users/auxten/Library/Caches/go-build"
GOENV="/Users/auxten/Library/Application Support/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="arm64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/auxten/Codes/go/pkg/mod"
GONOPROXY="github.com/auxten/*"
GONOSUMDB="github.com/auxten/*"
GOOS="darwin"
GOPATH="/Users/auxten/Codes/go"
GOPRIVATE="github.com/auxten/*"
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_arm64"
GOVCS=""
GOVERSION="go1.18beta1"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/dev/null"
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 arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/8l/5v4c2kl17hx82psrh8x09grm0000gq/T/go-build2410796747=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

assume there is a dir with one file in it, which is dir/file1 and dir/file2

filepath.Walk("dir/../dir", func(path string, info fs.FileInfo, err error) error {
		fmt.Println(path)
		return err
	})

What did you expect to see?

dir
dir/file1
dir/file2

What did you see instead?

dir/../dir
dir/file1
dir/file2

which is the similar case for filepath.WalkDir

@gopherbot
Copy link

Change https://golang.org/cl/378794 mentions this issue: path/filepath: pass clean path to WalkDirFunc and WalkFunc

@seankhliao seankhliao added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Jan 16, 2022
@ianlancetaylor ianlancetaylor added this to the Go1.19 milestone Jan 16, 2022
@ianlancetaylor ianlancetaylor modified the milestones: Go1.19, Backlog Jun 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
Status: No status
Development

Successfully merging a pull request may close this issue.

4 participants