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

filepath.Walk broken #3486

Closed
gopherbot opened this issue Apr 6, 2012 · 2 comments
Closed

filepath.Walk broken #3486

gopherbot opened this issue Apr 6, 2012 · 2 comments

Comments

@gopherbot
Copy link

by kfox1111:

Before filing a bug, please check whether it has been fixed since the
latest release. Search the issue tracker and check that you're running the
latest version of Go:

Run "go version" and compare against
http://golang.org/doc/devel/release.html  If a newer version of Go exists,
install it and retry what you did to reproduce the problem.

Thanks.

What steps will reproduce the problem?
If possible, include a link to a program on play.golang.org.
1. create a tree of stuff in /tmp, make sure one directory with children is does not
have permissions for you to access.

filepath.Walk("/tmp", func f(path string, info os.Fileinfo, err error) {
    if info.IsDir() && err != nil {
      //I don't care, keep going.
      return filepath.SkipDir
    } else {
      //good stuff here
      fmt.Printf("Found %s\n", path)
    }
}


What is the expected output?
The whole tree, excluding things you don't have permission to.

What do you see instead?
The first permission denied cuts short the tree walk.

Fix?
This looks to be because filepath.walk only checks for SkipDir when err = nil.

Which compiler are you using (5g, 6g, 8g, gccgo)?
6g

Which operating system are you using?
Windows

Which version are you using?  (run 'go version')
1

Please provide any additional information below.
@robpike
Copy link
Contributor

robpike commented Apr 7, 2012

Comment 1:

Labels changed: added priority-later, packagebug, removed priority-triage.

Owner changed to @robpike.

Status changed to Accepted.

@rsc
Copy link
Contributor

rsc commented Jun 2, 2012

Comment 2:

This issue was closed by revision 2b57a87.

Status changed to Fixed.

rsc pushed a commit that referenced this issue May 11, 2015
…vior

««« backport 4ef88bab4b0d
path/filepath: implement documented SkipDir behavior

Currently walk() doesn't check for err == SkipDir when iterating
a directory list, but such promise is made in the docs for WalkFunc.

Fixes #3486.

R=rsc, r
CC=golang-dev
https://golang.org/cl/6257059

»»»
@golang golang locked and limited conversation to collaborators Jun 24, 2016
@rsc rsc unassigned robpike Jun 22, 2022
This issue was closed.
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