siso: keep the hashfs entry when RemoveAll fails on disk

When clean-dead deletes a dead output and the disk removal fails, for
example due to a transient sharing violation on Windows, RemoveAll
still replaced the in-memory entry with one whose err field holds the
removal error. State() skips entries with a non-nil err, so the build
saved its state without that path. The next build derives
prevGenerated only from loaded state entries, so the file never
appeared in PreviouslyGeneratedFiles again and clean-dead never
retried the removal. One transient error was enough to exempt a dead
file from cleanup forever.

A failed RemoveAll always leaves the root path on disk. So in that
case, keep the recorded entry (still invalidating the dir-input
cache) and store the not-exist entry only when the disk removal
succeeded. The kept root entry keeps its cmdhash, so the next build's
clean-dead retries the removal.

Children need the opposite treatment: a failed RemoveAll may already
have deleted some of them, and those must not stay recorded. CleanDead
only warns and continues into the build, and a stale child entry can
satisfy Stat for a path that is gone from disk. If the manifest
meanwhile turned the directory output into a direct member output, an
unchanged command would be judged up to date and the build could
finish with the output missing. So drop every recorded child that
Lstat proves absent, and keep everything that is still on disk.

Change-Id: Ib88d5a5dd9654773a3ff554d9023af6bbb73c691
Reviewed-on: https://chromium-review.googlesource.com/c/build/+/8037824
Reviewed-by: Yuke Liao <liaoyuke@google.com>
Auto-Submit: Philipp Wollermann <philwo@google.com>
Commit-Queue: Neri Marschik <nerima@google.com>
3 files changed
tree: c864916a26ad03aa2d69eebdc458a0913886c4be
  1. bench/
  2. gong/
  3. hashigo/
  4. infra/
  5. kajiya/
  6. kzipinfo/
  7. remote-apis/
  8. runmc/
  9. siso/
  10. .gitignore
  11. .golangci.yml
  12. .style.yapf
  13. BUILD_OWNERS
  14. BUILD_TEAM_OWNERS
  15. CONTRIBUTING.md
  16. LICENSE
  17. OWNERS
  18. PRESUBMIT.py
  19. README.md
  20. WATCHLISTS
README.md

build.git repository

This repository contains tools developed and owned by the Chrome Build Team.

Quick start

The steps for getting the code are:

  1. Install depot_tools
  2. Run git clone https://chromium.googlesource.com/build

We use the standard Go module workflow to work on our projects.

Links