-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Description
Hello,
I've noticed some strange behavior regarding how bazel evaluates invalid symlinks.
UC1:
When I declare an invalid symlink, in a custom rule, and I build a bazel target of that kind bazel prints out the message:
Error in declare_symlink: actions.declare_symlink() is not allowed; use the --experimental_allow_unresolved_symlinks command line option
As expected when the suggested option is added the target builds successfully.
UC2:
However when I declare a folder and add a invalid symlink in that folder I get:
ERROR: (...): Failed to resolve relative path invalid_symlink inside TreeArtifact (...) The associated file is either missing or is an invalid symlink.
Adding the --experimental_allow_unresolved_symlinks does not work in this case.
This seems like inconsistent behavior. Also it is pretty common to pack build artifacts that contain invalid symlinks that will only become valid when the package is installed on the intended target.
I looked in the documentation and did not find a way to circumvent the issue.
I prepared a minimal working example to replicate the problem: https://github.com/GWLeal/bazel_invalid_symlinks_ex
UC1:
bazel build //test:symlink_test
UC2:
bazel build //test:dir_symlink_test
I'm currently using bazel version 5.1.1
Thank you in advance for taking the time to look into this :)