-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Allow unresolved symlinks inside a tree artifact #15454
Copy link
Copy link
Closed as not planned
Labels
P3We're not considering working on this, but happy to review a PR. (No assignee)We're not considering working on this, but happy to review a PR. (No assignee)staleIssues or PRs that are stale (no activity for 30 days)Issues or PRs that are stale (no activity for 30 days)team-Rules-APIAPI for writing rules/aspects: providers, runfiles, actions, artifactsAPI for writing rules/aspects: providers, runfiles, actions, artifactstype: feature request
Metadata
Metadata
Assignees
Labels
P3We're not considering working on this, but happy to review a PR. (No assignee)We're not considering working on this, but happy to review a PR. (No assignee)staleIssues or PRs that are stale (no activity for 30 days)Issues or PRs that are stale (no activity for 30 days)team-Rules-APIAPI for writing rules/aspects: providers, runfiles, actions, artifactsAPI for writing rules/aspects: providers, runfiles, actions, artifactstype: feature request
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 optionAs 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_testUC2:
bazel build //test:dir_symlink_testI'm currently using bazel version 5.1.1
Thank you in advance for taking the time to look into this :)