-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Open
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)not staleIssues or PRs that are inactive but not considered staleIssues or PRs that are inactive but not considered staleteam-Rules-APIAPI for writing rules/aspects: providers, runfiles, actions, artifactsAPI for writing rules/aspects: providers, runfiles, actions, artifactstype: bug
Description
ctx.actions.symlink always makes absolute symlinks when target_path is used, regardless of whether target_path is absolute.
Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
WORKSAPCE.bazel
BUILD.bazel
load(":rules.bzl", "example")
example(
name = "example",
)rules.bzl
def _example_impl(ctx):
example1 = ctx.actions.declare_symlink("example1")
ctx.actions.symlink(output = example1, target_path = "../..")
example2 = ctx.actions.declare_symlink("example2")
ctx.actions.run(executable = "ln", arguments = ["-s", "../..", example2.path], outputs = [example2])
return DefaultInfo(
files = depset([example1, example2])
)
example = rule(
implementation = _example_impl
)$ bazel build --experimental_allow_unresolved_symlinks :example
$ ls -l bazel-bin/
lrwxrwxrwx 1 paul paul 68 Nov 4 01:06 example1 -> /home/paul/.cache/bazel/_bazel_paul/fc54cd89f1e9b3d4a2b86f2842cad4ca
lrwxrwxrwx 1 paul paul 5 Nov 4 01:06 example2 -> ../..
I expected both symlinks to be ''../.." but only the latter (using executable ln) is.
Documentation: https://docs.bazel.build/versions/main/skylark/lib/actions.html#symlink
(Experimental) The exact path that the output symlink will point to. No normalization or other processing is applied. Access to this feature requires setting --experimental_allow_unresolved_symlinks.
What operating system are you running Bazel on?
Ubuntu 18.04
What's the output of bazel info release?
4.2.1
Reactions are currently unavailable
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)not staleIssues or PRs that are inactive but not considered staleIssues or PRs that are inactive but not considered staleteam-Rules-APIAPI for writing rules/aspects: providers, runfiles, actions, artifactsAPI for writing rules/aspects: providers, runfiles, actions, artifactstype: bug