Repository-Metriken
- Stars
- (25.384 Stars)
- PR-Merge-Metriken
- (Durchschn. Merge 22T 20h) (77 gemergte PRs in 30 T)
Beschreibung
Description of the bug:
When a repository rule implementation wants to report a failure, the only option right now is to use fail(<msg>), but that will print the message three times in the output. Here is an example with a syntax error, but fail() invocations behave the same:
The problem is that this error message is the only place to provide information about the failure. We often see messages spanning 10s or 100s of lines there from rules_nixpkgs, as the error contains the output of the underlying command. Printing it three times (four including quiet = False) scrambles the log, and is generally unhelpful.
Not sure about the proper fix, but maybe an 'error()' builtin, related to https://github.com/bazelbuild/bazel/issues/4772 ?
Or wrapping https://github.com/bazelbuild/bazel/blob/7.0.0-pre.20230123.5/src/main/java/com/google/devtools/build/lib/bazel/repository/starlark/StarlarkRepositoryFunction.java#L267-L273 with an AlreadyReportedRepositoryAccessException ?, leaving only the last one to get rid of ?
My impression here is that the two backtraces are about the same, and one should go. As for the last error, it should only contain a single line summary, not the full message again.
See https://gist.github.com/layus/005db27d799612bc7cbc0ccbf4cf554d#file-output-md for more insights
What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
See https://gist.github.com/layus/005db27d799612bc7cbc0ccbf4cf554d#file-output-md for a detailed MWE.
Which operating system are you running Bazel on?
Ubuntu
What is the output of bazel info release?
7.0.0-pre.20230123.5
If bazel info release returns development version or (@non-git), tell us how you built Bazel.
built with nix
What's the output of git remote get-url origin; git rev-parse master; git rev-parse HEAD ?
No response
Have you found anything relevant by searching the web?
No response
Any other information, logs, or outputs that you want to share?
https://gist.github.com/layus/005db27d799612bc7cbc0ccbf4cf554d#file-output-md
Also, a library-side improvement for readability https://github.com/tweag/rules_nixpkgs/pull/389