Skip to content

Commit

Permalink
Ignore directories without read permissions (bazelbuild#555)
Browse files Browse the repository at this point in the history
Currently we check if we can read the metadata from the file/directory. Even if we can stat the file, it does not necessarily mean we have permissions to open the file/directory. This becomes a problem when we try to open the directory when computing the merkle tree and we don't have read permissions.
  • Loading branch information
andusy authored and mrahs committed Apr 29, 2024
1 parent aa27e5f commit f342796
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion go/pkg/client/tree.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ func shouldIgnoreErr(err error) bool {
if e, ok := err.(*filemetadata.FileError); ok {
return os.IsPermission(e.Err)
}
return false
return os.IsPermission(err)
}

func getRelPath(base, path string) (string, error) {
Expand Down Expand Up @@ -367,6 +367,9 @@ func loadFiles(execRoot, localWorkingDir, remoteWorkingDir string, excl []*comma

f, err := os.Open(absPath)
if err != nil {
if shouldIgnoreErr(err) {
continue
}
return err
}

Expand Down

0 comments on commit f342796

Please sign in to comment.