Skip to content

import paths from external Bazel modules are broken with Bazel 8.0.0 #2515

Closed
@armandomontanez

Description

@armandomontanez

Summary

imports runfiles handling of external projects appears to have broken with the switch to --legacy_external_runfiles=False in Bazel 8.0.0.

Minimal reproducer

https://github.com/armandomontanez/bazel_reproducers/tree/main/external_runfiles_broken_rules_python

Reproduces on both macOS and linux.

Additional notes

I haven't unwound yet whether or not all import handling of external py_* rules are completely broken, I noticed this specifically with py_proto_library rules that use strip_import_prefix and live in an external repository.

I noticed this when working with nanopb where sys.path reported the import path as:

/private/var/tmp/_bazel_amontanez/e724b21efc8bc19866072fbc72ee5907/sandbox/darwin-sandbox/7/execroot/_main/bazel-out/darwin_x86_64-opt-exec-ST-e8d06b237d06/bin/external/nanopb+/protoc-gen-nanopb.runfiles/_main/external/nanopb+/_virtual_imports/nanopb_proto

when the files actually existed at:

/private/var/tmp/_bazel_amontanez/e724b21efc8bc19866072fbc72ee5907/sandbox/darwin-sandbox/7/execroot/_main/bazel-out/darwin_x86_64-opt-exec-ST-e8d06b237d06/bin/external/nanopb+/protoc-gen-nanopb.runfiles/_main/../nanopb+/_virtual_imports/nanopb_proto

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions