bazel icon indicating copy to clipboard operation
bazel copied to clipboard

Crash when trying to call Label.relative() in a BzlMod module extension implementation function

Open digit-google opened this issue 2 years ago • 1 comments

Description of the bug:

As the title says, trying to call Label.relative() within a module extension implementation function results in a runtime crash. I have uploaded a reproduction case to my github account (see below).

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

See https://github.com/digit-google/bazel-experiments/tree/main/bzlmod-module-extensions/crash-with-label-relative-call

Which operating system are you running Bazel on?

Linux

What is the output of bazel info release?

release 5.3.0rc1

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 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?

No response

digit-google avatar Aug 02 '22 19:08 digit-google

Thanks for reporting that! I've tested your example on the latest main commit of this GitHub repo (i.e. using Bazilisk with the USE_BAZEL_VERSION=last_green option) and the issue seems to not be present anymore. However, your code fails because there is no repository called @ext_module with a rule called :files. After I fix these, your example works fine for me. Please let me know if you have any other issues with this.

andyrinne12 avatar Aug 09 '22 12:08 andyrinne12

As @andyrinne12 pointed out, this is fixed on HEAD. The fix is not trivial to cherry-pick back to 5.3.0, so we might just ask you to test with last_green instead. Thanks!

Wyverald avatar Aug 11 '22 13:08 Wyverald