-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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-CoreSkyframe, bazel query, BEP, options parsing, bazelrcSkyframe, bazel query, BEP, options parsing, bazelrctype: feature request
Description
Description of the problem / feature request:
Bazel navigates into symbolic links when searching for BUILD files. This can be divided into two scenarios:
- The symbolic link points to another location within the workspace. In this case, all paths reachable through the link are already reachable without it, thus there is no reason to continue.
- The symbolic link points to a location outside of the workspace. This seems like a dubious use case. Is this really an intended feature? I would expect everything outside of the workspace should be pulled in using a workspace rule.
Description of the problem / feature request:
Do not traverse symbolic links when looking for BUILD files in a workspace.
Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
$ git clone https://github.com/crorvick/bazel-hello.git
Cloning into 'bazel-hello'...
remote: Enumerating objects: 22, done.
remote: Total 22 (delta 0), reused 0 (delta 0), pack-reused 22
Unpacking objects: 100% (22/22), done.
$ mkdir empty
$ cd empty/
$ touch WORKSPACE
$ ln -s ../bazel-hello .
$ bazel build ...
Starting local Bazel server and connecting to it...
INFO: Invocation ID: 1f6bc1d1-68d2-4c64-ab9c-20f55cfb9ba7
Loading:
Loading: 0 packages loaded
ERROR: error loading package 'bazel-hello/src/hello': Unable to load package for '//src/optimize:optimize.bzl': BUILD file not found on package path
INFO: Elapsed time: 1.294s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (2 packages loaded)
FAILED: Build did NOT complete successfully (2 packages loaded)
A slightly more complex, but less contrived scenario:
$ git clone https://github.com/crorvick/bazel-hello.git
Cloning into 'bazel-hello'...
remote: Enumerating objects: 22, done.
remote: Total 22 (delta 0), reused 0 (delta 0), pack-reused 22
Unpacking objects: 100% (22/22), done.
$ cd bazel-hello/
$ bazel build ...
Starting local Bazel server and connecting to it...
INFO: Invocation ID: d8aee92d-b92a-4198-8ad1-f2db4cde17b2
Loading:
Loading: 0 packages loaded
Analyzing: 4 targets (5 packages loaded)
Analyzing: 4 targets (5 packages loaded, 0 targets configured)
INFO: Analysed 4 targets (20 packages loaded, 505 targets configured).
INFO: Found 4 targets...
[0 / 5] no action
INFO: Elapsed time: 3.158s, Critical Path: 0.52s
INFO: 7 processes: 7 linux-sandbox.
INFO: Build completed successfully, 20 total actions
INFO: Build completed successfully, 20 total actions
$ cd ..
$ mv bazel-hello bazel-hello-bak
$ cd bazel-hello-bak
$ bazel build ...
Starting local Bazel server and connecting to it...
INFO: Invocation ID: 5c1430a6-4ff2-47c1-bf3c-fb3c5600672d
Loading:
Loading: 0 packages loaded
ERROR: error loading package 'bazel-bazel-hello/external/bazel_tools/tools/jdk': Unable to load package for '//tools/jdk:default_java_toolchain.bzl': BUILD file not found on package path
INFO: Elapsed time: 1.343s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (8 packages loaded)
FAILED: Build did NOT complete successfully (8 packages loaded)
Bazel is tripping over its bazel-<project> symbolic link in the above example after the parent directory is renamed. A confound in resolving this particular issue is that it adding /bazel-* to the list of ignored file patterns by Git (or whatever VCS is used) is a reasonable thing to do since the bazel-<project> link is not predictable from what is under Git's control.
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)staleIssues or PRs that are stale (no activity for 30 days)Issues or PRs that are stale (no activity for 30 days)team-CoreSkyframe, bazel query, BEP, options parsing, bazelrcSkyframe, bazel query, BEP, options parsing, bazelrctype: feature request