rules_proto icon indicating copy to clipboard operation
rules_proto copied to clipboard

Bad syntax for proto_repository_tools_srcs.bzl

Open ewhauser opened this issue 2 years ago • 3 comments

We occasionally run into the following issue:

ERROR: /home/runner/.cache/bazel/_bazel_runner/5c738117ebb090237e98e16aae223a35/external/build_stack_rules_proto/rules/private/proto_repository_tools_srcs.bzl:666:15: syntax error at 'newline': expected ]

It is unfortunately not easily reproduced. It often happens after a Bazel version upgrade. Once the repository gets in this state, only a bazel clean --expunge will let it recover. Interestingly, when you open that file, it is completely valid Starlark and the array is closed properly.

ewhauser avatar Aug 01 '23 15:08 ewhauser

There is a difference between rules_proto and gazelle here. Gazelle is only checking to see if this list is up to date and rules_proto seems to be trying to generate the file in the action. Could it be that writing to the file while building is somehow corrupting?

https://github.com/stackb/rules_proto/blob/master/rules/private/proto_repository_tools.bzl#L72 https://github.com/bazelbuild/bazel-gazelle/blob/master/internal/go_repository_tools.bzl#L80

ewhauser avatar Aug 01 '23 18:08 ewhauser

I was able to get this fixed for us by commented out L62-77 in a patch. Possible theory here is that updating this file while building causes a corruption and it gets cached remotely which is why it is non-deterministic.

ewhauser avatar Aug 01 '23 18:08 ewhauser

I struggle with this occasionally as well. I have tried always enabling the -check but don't want to break users until it's sorted out.

pcj avatar Feb 17 '24 22:02 pcj