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

local_path_override doesn't get invalidated for MODULE.bazel file creation #22687

Closed
illicitonion opened this issue Jun 11, 2024 · 1 comment
Closed
Assignees
Labels
P1 I'll work on this now. (Assignee required) team-ExternalDeps External dependency handling, remote repositiories, WORKSPACE file. type: bug

Comments

@illicitonion
Copy link
Contributor

Description of the bug:

If you set a local_path_override to a directory which doesn't contain a MODULE.bazel, then create one, a subsequent build will continue to complain that the file didn't exist.

Which category does this issue belong to?

External Dependency

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

% mkdir root_module 
% mkdir loaded_module
% cat >root_module/MODULE.bazel <<EOF     
bazel_dep(name = "loaded_module")

local_path_override(module_name = "loaded_module", path="$(pwd)/loaded_module")
EOF
% cat >root_module/BUILD.bazel <<EOF      
filegroup(name = "fg")           
EOF
% cd root_module
% bazel query ...
ERROR: <builtin>: fetching local_repository rule //:loaded_module~: java.io.IOException: No MODULE.bazel, REPO.bazel, or WORKSPACE file found in /Users/dwagnerhall/tmp/repro/loaded_module
ERROR: Error computing the main repository mapping: error during computation of main repo mapping: No MODULE.bazel, REPO.bazel, or WORKSPACE file found in /Users/dwagnerhall/tmp/repro/loaded_module
% cat >../loaded_module/MODULE.bazel <<EOF
module(name = "loaded_module")   
EOF
% bazel query ...
ERROR: <builtin>: fetching local_repository rule //:loaded_module~: java.io.IOException: No MODULE.bazel, REPO.bazel, or WORKSPACE file found in /Users/dwagnerhall/tmp/repro/loaded_module
ERROR: Error computing the main repository mapping: error during computation of main repo mapping: No MODULE.bazel, REPO.bazel, or WORKSPACE file found in /Users/dwagnerhall/tmp/repro/loaded_module
% bazel shutdown
% bazel query ...
Starting local Bazel server and connecting to it...
//:fg

The query before the shutdown should have worked because the situation on disk was resolved and the repository fetch should have been invalidated by the filesystem changes.

Note that sometimes the first query only prints the second error not the first - when that happens, the first query after creating the MODULE.bazel file will work.

Which operating system are you running Bazel on?

macOS

What is the output of bazel info release?

release 7.2.0

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

@github-actions github-actions bot added the team-ExternalDeps External dependency handling, remote repositiories, WORKSPACE file. label Jun 11, 2024
@fmeum fmeum self-assigned this Jun 11, 2024
@fmeum fmeum added P1 I'll work on this now. (Assignee required) and removed untriaged labels Jun 11, 2024
bazel-io pushed a commit to bazel-io/bazel that referenced this issue Jun 11, 2024
Fixes bazelbuild#22687

Closes bazelbuild#22700.

PiperOrigin-RevId: 642340825
Change-Id: I96f496b309c4740ae561f69098eca54a12a574f0
bazel-io pushed a commit to bazel-io/bazel that referenced this issue Jun 11, 2024
Fixes bazelbuild#22687

Closes bazelbuild#22700.

PiperOrigin-RevId: 642340825
Change-Id: I96f496b309c4740ae561f69098eca54a12a574f0
github-merge-queue bot pushed a commit that referenced this issue Jun 11, 2024
Fixes #22687

Closes #22700.

PiperOrigin-RevId: 642340825
Change-Id: I96f496b309c4740ae561f69098eca54a12a574f0

Commit
b868a59

Co-authored-by: Fabian Meumertzheim <fabian@meumertzhe.im>
github-merge-queue bot pushed a commit that referenced this issue Jun 11, 2024
Fixes #22687

Closes #22700.

PiperOrigin-RevId: 642340825
Change-Id: I96f496b309c4740ae561f69098eca54a12a574f0

Commit
b868a59

Co-authored-by: Fabian Meumertzheim <fabian@meumertzhe.im>
@iancha1992
Copy link
Member

A fix for this issue has been included in Bazel 7.3.0 RC1. Please test out the release candidate and report any issues as soon as possible.
If you're using Bazelisk, you can point to the latest RC by setting USE_BAZEL_VERSION=7.3.0rc1. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P1 I'll work on this now. (Assignee required) team-ExternalDeps External dependency handling, remote repositiories, WORKSPACE file. type: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants