Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bzlmod doesn't exclude bazel-* from ellipsis by default in submodules #24190

Open
charleysaintNV opened this issue Nov 4, 2024 · 0 comments
Open
Labels
area-Bzlmod Bzlmod-specific PRs, issues, and feature requests help wanted Someone outside the Bazel team could own this P2 We'll consider working on this in future. (Assignee optional) team-ExternalDeps External dependency handling, remote repositiories, WORKSPACE file. type: bug

Comments

@charleysaintNV
Copy link

Description of the bug:

If you run bazel build ... in a root module it will by default exclude the standard symlink dirs that get created by bazel (bazel-bin, bazel-out, etc.). If you cd into a submodule and do this it will create the symlink dirs and will work fine there, but if you go back to the root module and try to build everything in a submodule (bazel build @submodule//...) it will likely fail because it will go into the bazel-out dirs that were created by running directly in the submodule and find many broken build files. Errors like

Unable to find package for @@[unknown repo]

Adding these bazel- dirs into .bazelignore in the submodule will cause it to behave as it does when bazel is called from under the directory of the submodule.

Which category does this issue belong to?

No response

What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.

Clone rules_python repo locally and cd into the directory in examples/bzlmod. Run this, should succeed

examples/bzlmod$ bazel build @our_other_module//...

cd into other_module and open the MODULE.bazel and uncomment the local_path_override. Build the other module from this dir

examples/bzlmod/other_module$ bazel build ...

cd back to the bzlmod dir and build @our_other_module//... again now, should error

examples/bzlmod$ bazel build @our_other_module//...
ERROR: infinite symlink expansion detected
[start of symlink chain]
.../execroot/_main/external/rules_python~
.../external/rules_python~
examples/bzlmod/other_module/bazel-other_module/external/rules_python~
[end of symlink chain]
ERROR: Infinite symlink expansion, for bazel-other_module/external/rules_python~, skipping: Infinite symlink expansion
WARNING: Target pattern parsing failed.
ERROR: Skipping '@our_other_module//...': error loading package under directory '': error loading package '@@other_module~//bazel-other_module/external/rules_python~~pip~other_module_pip/absl_py': Unable to find package for @@[unknown repo 'bazel_skylib' requested from @@other_module~]//lib:selects.bzl: The repository '@@[unknown repo 'bazel_skylib' requested from @@other_module~]' could not be resolved: No repository visible as '@bazel_skylib' from repository '@@other_module~'.
ERROR: error loading package under directory '': error loading package '@@other_module~//bazel-other_module/external/rules_python~~pip~other_module_pip/absl_py': Unable to find package for @@[unknown repo 'bazel_skylib' requested from @@other_module~]//lib:selects.bzl: The repository '@@[unknown repo 'bazel_skylib' requested from @@other_module~]' could not be resolved: No repository visible as '@bazel_skylib' from repository '@@other_module~'.
INFO: Elapsed time: 0.095s
INFO: 0 processes.

you can create a .bazelignore in the submodule with the following and the error will go away

bazel-bin
bazel-other_module
bazel-out
bazel-testlogs

Which operating system are you running Bazel on?

Ubuntu 24.04

What is the output of bazel info release?

release 7.3.1

If bazel info release returns development version or (@non-git), tell us how you built Bazel.

No response

What's the output of git remote get-url origin; git rev-parse HEAD ?

No response

If this is a regression, please try to identify the Bazel commit where the bug was introduced with bazelisk --bisect.

No response

Have you found anything relevant by searching the web?

No response

Any other information, logs, or outputs that you want to share?

No response

@satyanandak satyanandak added team-ExternalDeps External dependency handling, remote repositiories, WORKSPACE file. area-Bzlmod Bzlmod-specific PRs, issues, and feature requests labels Nov 5, 2024
@meteorcloudy meteorcloudy added P3 We're not considering working on this, but happy to review a PR. (No assignee) help wanted Someone outside the Bazel team could own this P2 We'll consider working on this in future. (Assignee optional) and removed untriaged P3 We're not considering working on this, but happy to review a PR. (No assignee) labels Nov 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-Bzlmod Bzlmod-specific PRs, issues, and feature requests help wanted Someone outside the Bazel team could own this P2 We'll consider working on this in future. (Assignee optional) team-ExternalDeps External dependency handling, remote repositiories, WORKSPACE file. type: bug
Projects
None yet
Development

No branches or pull requests

5 participants