diff --git a/pkg/sympath/walk.go b/pkg/sympath/walk.go index b2500284a..24f4d340b 100644 --- a/pkg/sympath/walk.go +++ b/pkg/sympath/walk.go @@ -63,7 +63,9 @@ func readDirNames(dirname string) ([]string, error) { // symwalk recursively descends path, calling walkFn. func symwalk(path string, info os.FileInfo, walkFn filepath.WalkFunc) error { - // Recursively walk symlinked directories. + // When a symlink is encountered, only replace the resolved info, don't + // walk the resolved symlink path since the walk should be as if path + // were the actual linked to path. if IsSymlink(info) { resolved, err := filepath.EvalSymlinks(path) if err != nil { @@ -72,9 +74,6 @@ func symwalk(path string, info os.FileInfo, walkFn filepath.WalkFunc) error { if info, err = os.Lstat(resolved); err != nil { return err } - if err := symwalk(resolved, info, walkFn); err != nil && err != filepath.SkipDir { - return err - } } if err := walkFn(path, info, nil); err != nil {