Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Avoid creating symlinks that point out of output TreeArtifact
`cp -r` copies the _symlinks_, not the destination of symlinks. This results in a TreeArtifact with symlinks to content _outside_ the TreeArtifact, which is not well defined in bazel[^1]. At least bazel 7.1.1's linux-sandbox (bazel --spawn_strategy=sandboxed on Linux) does not follow the symlinks and destroys the temporary directory containing the actual files after the action, leaving a TreeArtifact of dangling symlinks. `cp -rL` chases the symlinks and creates a TreeArtifact of regular files. This has the desired behaviour in all bazel versions/sandboxes. [^1]: See discussion in bazelbuild/bazel#15454. It is unclear whether we _want_ to resolve these symlinks or leave them dangling, and behaviour varies across bazel versions and execution environment.
- Loading branch information