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: WalkFunc is called with a "file does not exist" error if a file is deleted between readdirnames and lstat (inside walk). #24959

Open
akmistry opened this issue Apr 20, 2018 · 1 comment
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@akmistry
Copy link

Please answer these questions before submitting your issue. Thanks!

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

% go version
go version go1.10 linux/amd64

Does this issue reproduce with the latest release?

Yes.

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

% go env
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/amistry/.cache/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/amistry/go-src"
GORACE=""
GOROOT="/home/amistry/go"
GOTMPDIR=""
GOTOOLDIR="/home/amistry/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build740843021=/tmp/go-build -gno-record-gcc-switches"

What did you do?

Call filepath.Walk on a directory where files are being constantly deleted (and added).

What did you expect to see?

No errors.

What did you see instead?

"file does not exist" errors. If a file doesn't exist, why are you telling me about it?

I guess this is more of a question of semantics. If a file a deleted between the directory listing and lstat, should the caller be told, or should this case be hidden? If a file is deleted before the readdirnames, then there's no error. If a file is added between readdirnames and lstat, it is hidden from the caller. I'd argue that hiding the error is a more consistent and expected.

@ianlancetaylor
Copy link
Contributor

I think skipping the call would probably be OK if we can determine that it is the file that does not exist, rather than, say, the containing directory. I don't know whether it is worth making the change.

@ianlancetaylor ianlancetaylor added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Apr 20, 2018
@ianlancetaylor ianlancetaylor added this to the Unplanned milestone Apr 20, 2018
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
None yet
Development

No branches or pull requests

2 participants