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

Invalid bzlmod overrides are ignored #17125

Closed
keith opened this issue Jan 3, 2023 · 7 comments
Closed

Invalid bzlmod overrides are ignored #17125

keith opened this issue Jan 3, 2023 · 7 comments
Labels
area-Bzlmod Bzlmod-specific PRs, issues, and feature requests good first issue help wanted Someone outside the Bazel team could own this not stale Issues or PRs that are inactive but not considered stale P2 We'll consider working on this in future. (Assignee optional) team-ExternalDeps External dependency handling, remote repositiories, WORKSPACE file. type: bug

Comments

@keith
Copy link
Member

keith commented Jan 3, 2023

If you have some archive_override in your MODULE.bazel file that attempts to override a repository that doesn't exist, bazel silently ignores it. I think ideally bazel would error in this case, since it likely points to you trying to override something that you're not pulling in at all.

@sgowroji sgowroji added more data needed team-ExternalDeps External dependency handling, remote repositiories, WORKSPACE file. area-Bzlmod Bzlmod-specific PRs, issues, and feature requests labels Jan 4, 2023
@sgowroji
Copy link
Member

sgowroji commented Jan 4, 2023

Hello @keith, Could you please provide minimal steps to reproduce the above issue. Thanks!

@keith
Copy link
Member Author

keith commented Jan 4, 2023

Yea the repro case is if you have a MODULE.bazel with:

archive_override(
    integrity = "sha256-+T69g/MobVF0j4bpoOToa6eQqinQULa6w6dqhymuEjc=",
    module_name = "foo",
    strip_prefix = "apple_support-441103ea05ffbde2da9f77252e27e4f519e01c72",
    urls = [
        "https://github.com/bazelbuild/apple_support/archive/441103ea05ffbde2da9f77252e27e4f519e01c72.tar.gz",
    ],
)

and you have a BUILD file with:

cc_library(name = "main", srcs = ["main.c"])

and main.c is:

int main() { return 0; }

building with bazel build main --enable_bzlmod will work, where I think it should potentially fail because we're trying to override foo which doesn't exist. I'm not sure if all the info available to do this exists, but since it's less lazy than the WORKSPACE I assume it might be possible

@Wyverald Wyverald added the P3 We're not considering working on this, but happy to review a PR. (No assignee) label Jan 4, 2023
@Wyverald
Copy link
Member

Wyverald commented Jan 4, 2023

@github-actions
Copy link

github-actions bot commented Feb 9, 2023

Thank you for contributing to the Bazel repository! This issue has been marked as stale since it has not had any activity in the last 30 days. It will be closed in the next 7 days unless any other activity occurs or the "not stale" label is added.

@github-actions github-actions bot added the stale Issues or PRs that are stale (no activity for 30 days) label Feb 9, 2023
@brentleyjones
Copy link
Contributor

@keertk not stale, triaged and not waiting for input

@sgowroji sgowroji removed the stale Issues or PRs that are stale (no activity for 30 days) label Feb 9, 2023
@keertk keertk added the not stale Issues or PRs that are inactive but not considered stale label Feb 9, 2023
@meteorcloudy meteorcloudy added help wanted Someone outside the Bazel team could own this P2 We'll consider working on this in future. (Assignee optional) good first issue and removed P3 We're not considering working on this, but happy to review a PR. (No assignee) labels Sep 7, 2023
@meteorcloudy meteorcloudy added this to the 7.0.0 branch cut milestone Sep 7, 2023
@yokeshwaran1
Copy link

Hi @keith @Wyverald and Bazel team,
I read the details of this issue and suggested fix. I like to work on this and provide a PR to fix the problem with 'archive_override' in 'MODULE.bazel'. I will start by checking the code at the provided link in BazelModuleResolutionFunction.java and come up with approach to introduce the necessary checks. Pls let me know if there r any additional considerations or if anyone else is already working on this.

@keith
Copy link
Member Author

keith commented Sep 9, 2023

Sounds good!

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 good first issue help wanted Someone outside the Bazel team could own this not stale Issues or PRs that are inactive but not considered stale P2 We'll consider working on this in future. (Assignee optional) team-ExternalDeps External dependency handling, remote repositiories, WORKSPACE file. type: bug
Projects
Archived in project
Development

No branches or pull requests

7 participants