fix: support cleaning root output directory in DownloadActionOutputs (#667)

When an action specifies that the entire working directory is an output
directory (dir.Path is "" or "."), relPath evaluates to ".".
Attempting to call root.RemoveAll(".") fails with "RemoveAll .: invalid argument"
(syscall.EINVAL) because os.Root cannot delete its own root directory.

Add a removeAllUnder helper function that normalizes relPath with filepath.Clean,
and if relPath resolves to ".", removes all entries inside root instead.

Extend the existing TestDownloadActionOutputs to include an output directory
with Path "" to prevent regressions.

Signed-off-by: Yaowen Mei <ywmei@google.com>
2 files changed
tree: 484df8eab73d78b6424d180aa541b80f61ae4c19
  1. .bazelci/
  2. .githooks/
  3. .github/
  4. external/
  5. go/
  6. .bazelrc
  7. .bazelversion
  8. .gitignore
  9. .golangci.yml
  10. AUTHORS
  11. BUILD.bazel
  12. check-gofmt.sh
  13. check-golint.sh
  14. CONTRIBUTING.md
  15. CONTRIBUTORS
  16. go.mod
  17. go.sum
  18. LICENSE
  19. MODULE.bazel
  20. MODULE.bazel.lock
  21. README.md
  22. setup-githooks.sh
README.md

Remote Execution API SDKs

CI status: Build Status

PkgGoDev

This repository contains SDKs for the Remote Execution API.

See each language subdirectory's README.md for more specific instructions on using the SDK for that language.