`--remote_local_fallback` lead to undeclared inclusion
- Dominant language
- Java
- Stars
- 25.8k
- Forks
- 4.6k
- Avg merge
- 2d 18h
- Merged PRs (30d)
- 75
Description
### Description of the bug:
As said in #15519, the default strategy for `--remote_local_fallback` is `local`, which will cause build failure and report `undeclared inclusion`. When remote_execution with clang is failed, Bazel will fallback to local strategy, find the old cache file, which is a dependency file hello.pic.d, and upload it to Buildfarm cache directly. Then Bazel looked into the .d file and find out one header file is missing.
To solve this problem, we need to specify `--remote_local_fallback_strategy` to `sandboxed`, which is said no-op and deprecated in the [document](https://bazel.google.cn/reference/command-line-reference?hl=en#flag--remote_local_fallback_strategy).
Also,#7480 leads to misunderstanding, `--spawn_strategy` cannot replace `--remote_local_fallback_strategy`
### What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
In this [repo](https://github.com/liyuyun-lyy/undeclared_inclusion_demo), I wrote a demo to reproduce the bug.
### Which operating system are you running Bazel on?
linux
### What is the output of `bazel info release`?
5.2.0
### If `bazel info release` returns `development version` or `(@non-git)`, tell us how you built Bazel.
_No response_
### What's the output of `git remote get-url origin; git rev-parse master; git rev-parse HEAD` ?
_No response_
### Have you found anything relevant by searching the web?
_No response_
### Any other information, logs, or outputs that you want to share?
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.