-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Regression in 3.5.0RC1: external repo with malformed WORKSPACE causes spurious errors #11936
Comments
Do you have a specific old protobuf version to point to? That would save some time. |
I got a repro with v3.6.0 Commit SHA |
@alandonovan @brandjon You two are the most likely to have touched WORKSPACE loading recently. Any ideas? |
Judging by the title of the issue, it might be the same problem as #11837 (comment) cc @michajlo |
@laurentlb it does not look the same to me. #11837 is about WORKSPACE name. This issue is about WORKSPACE file in the repo pulled in by git_repository. That external WORKSPACE file should not be analysed at all and may contain garbage. This was the case till 3.4.1, but with 3.5.0RC1 it is clearly analysed by Bazel and syntax errors in that file are now reported as the errors in the build. |
Do you have a repro? |
Give me couple hours. |
I will want to add a regression test for this. What would be interesting to see in the repo is if this is about git_repository only or any repository. A local repository (or http_repository with a file:// scheme) with a corrupt WORKSPACE would be a nicely self-contained test. |
Could it be that workspaces were always being analyzed but errors were ignored and/or lost until now? |
As in, this could be another misbug fixed by 2436a35. |
@aiuto Here is what you asked for: https://github.com/Bazel-snippets/repro_11936
Despite the error the second build claims it is successful, so @michajlo is probably right that |
Thanks a lot for the repro! I confirm this is caused 2436a35. |
The doc says: |
Thanks. That answers so many questions.
So
|
Could we revert to the previous behavior (for now) and ask @philwo's team to investigate why WORKSPACE files are loaded? |
There are too many changes to the error reporting stack to do a rollback of that. It would be dependent on a fix forward to suppress the reporting if we want a short term fix. |
I'm not sure the |
I'd rather suppress the messages and keep the existing behavior, that seems safer to me. Changes in the behavior can be decided later (when we know what we're doing). |
I think we have a handle on the problem so we are going to try to fix forward and remove the unneeded parsing of the workspace. I have some tests I can try on Monday. |
I think I have a solution. I'm just trying to figure out where to hang a real regression test. The fix is basically deleting ~35 lines of code. ==== third_party/bazel/src/main/java/com/google/devtools/build/lib/rules/repository/RepositoryLoaderFunction.java#x - third_party/bazel/src/main/java/com/google/devtools/build/lib/rules/repository/RepositoryLoaderFunction.java ==== |
Fixes: #11936 I have an additional test to prove the spurious error message is gone and that I still can refer to a workspace by name, in https://github.com/aiuto/repro_11936/tree/more_tests I have not added it yet because it is not really clear what the correct behavior should be for external repos - should the WORKSPACE be valid and used, or ignored. This change brings the code in line with the documentation (ignored), but the better behavior might be different. RELNOTES: Stop needlessly parsing WORKSPACE files from external repositories. PiperOrigin-RevId: 327157715
Fixes: #11936 I have an additional test to prove the spurious error message is gone and that I still can refer to a workspace by name, in https://github.com/aiuto/repro_11936/tree/more_tests I have not added it yet because it is not really clear what the correct behavior should be for external repos - should the WORKSPACE be valid and used, or ignored. This change brings the code in line with the documentation (ignored), but the better behavior might be different. RELNOTES: Stop needlessly parsing WORKSPACE files from external repositories. PiperOrigin-RevId: 327157715
Fixes: bazelbuild#11936 I have an additional test to prove the spurious error message is gone and that I still can refer to a workspace by name, in https://github.com/aiuto/repro_11936/tree/more_tests I have not added it yet because it is not really clear what the correct behavior should be for external repos - should the WORKSPACE be valid and used, or ignored. This change brings the code in line with the documentation (ignored), but the better behavior might be different. RELNOTES: Stop needlessly parsing WORKSPACE files from external repositories. PiperOrigin-RevId: 327157715
Fixes: #11936 I have an additional test to prove the spurious error message is gone and that I still can refer to a workspace by name, in https://github.com/aiuto/repro_11936/tree/more_tests I have not added it yet because it is not really clear what the correct behavior should be for external repos - should the WORKSPACE be valid and used, or ignored. This change brings the code in line with the documentation (ignored), but the better behavior might be different. RELNOTES: Stop needlessly parsing WORKSPACE files from external repositories. PiperOrigin-RevId: 327157715
Fixes: #11936 I have an additional test to prove the spurious error message is gone and that I still can refer to a workspace by name, in https://github.com/aiuto/repro_11936/tree/more_tests I have not added it yet because it is not really clear what the correct behavior should be for external repos - should the WORKSPACE be valid and used, or ignored. This change brings the code in line with the documentation (ignored), but the better behavior might be different. RELNOTES: Stop needlessly parsing WORKSPACE files from external repositories. PiperOrigin-RevId: 327157715
Fixes: bazelbuild/bazel#11936 I have an additional test to prove the spurious error message is gone and that I still can refer to a workspace by name, in https://github.com/aiuto/repro_11936/tree/more_tests I have not added it yet because it is not really clear what the correct behavior should be for external repos - should the WORKSPACE be valid and used, or ignored. This change brings the code in line with the documentation (ignored), but the better behavior might be different. RELNOTES: Stop needlessly parsing WORKSPACE files from external repositories. PiperOrigin-RevId: 327157715
Description of the problem / feature request:
In the WORKSPACE file we have git_repository rule which pulls in another git repo. That git repo happens to have its own WORKSPACE file which is very old and is not correct for the recent versions of Bazel. Up until Bazel 3.4.1 that secondary WORKSPACE was rightfully completely ignored. Starting with the Bazel 3.5.0RC1 external WORKSPACE file seems to be analyzed for some reason and causes build errors.
Feature requests: what underlying problem are you trying to solve with this feature?
Accordingly to the docs only the primary WORKSPACE matters, all others should be ignored.
Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
Use git_repository to pull several years old com_google_protobuf. Its workspace file would not be correct from the recent Bazel point of view and cause errors, while it should be ignored.
What operating system are you running Bazel on?
Linux, Mac, Windows
What's the output of
bazel info release
?3.5.0RC1
The text was updated successfully, but these errors were encountered: