Open sushain97 opened 1 year ago
Thank you for contributing to the Bazel repository! This issue has been marked as stale since it has not had any activity in the last 30 days. It will be closed in the next 7 days unless any other activity occurs or the "not stale" label is added.
This issue is not stale.
Description of the bug:
Within a BEP stream, the
namedSetOfFiles
corresponding to a target contains entries with the identical (incomplete)name
field when the files meet the following criteria:repository_ctx.file
notactions.write
)This makes it impossible to associate a particular output of a rule with a given file, especially when using
--remote_download_minimal
and theuri
fields are opaque. Being able to associate outputs is useful if e.g. a rule outputs a manifest of its outputs that describes how to post-process them (e.g. "upload with these names").Here's an example stream:
If
File.path
is invoked on the generated file corresponding tofile:///private/var/tmp/_bazel/7bec43c1891cc58634d2eb9970f47206/external/monkey/food
, it would outputexternal/monkey/food
. Thus, the BEP should also have"name": "external/monkey/food"
. Alternatively, thename
field can stay ambiguous butpathPrefix
should be set to disambiguate the entries.Note that this works as expected if the file is generated by a standard build rule within the external repository. It only behaves this way when the file is created by a repository rule.
We suspect the issue may lie somewhere in this block: https://github.com/bazelbuild/bazel/blob/ccfeeff06cdc0266b92781213bbdf33c4288b1c5/src/main/java/com/google/devtools/build/lib/analysis/TargetCompleteEvent.java#L361-L389
cc @clint-stripe @sushain-stripe @qaisjp
What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
This bug is reproduced in https://github.com/sushain97/bazel-ambig-name-repro:
Which operating system are you running Bazel on?
macOS
What is the output of
bazel info release
?release 6.0.0
If
bazel info release
returnsdevelopment 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