Starlark runfiles merging silently drops --legacy_external_runfiles external runfiles links #17415
Labels
P4
This is either out of scope or we don't have bandwidth to review a PR. (No assignee)
team-Core
Skyframe, bazel query, BEP, options parsing, bazelrc
team-Rules-API
API for writing rules/aspects: providers, runfiles, actions, artifacts
type: bug
(Mostly filing this for posterity, as its a subtle behavior change that can be hard to debug)
Description of the bug:
When merging runfiles with the Starlark APIs (e.g.
ctx.runfiles().merge()
orctx.runfiles().merge_all()
), certain invocations will silently drop the "external/" paths that --legacy_external_runfiles (default true) creates.Looking at Runfiles.java, I see legacyExternalRunfiles is hard-coded to false in various spots.
I think the generalized case is: merging any two non-empty runfiles will drop legacyExternalRunfiles. This is because the Runfiles.Builder ctor argument legacyExternalRunfiles determines the final value (i.e. any intermediate
Runfiles objects being merged in don't have their legacyExternalRunfiles value considered).
The Runfiles.merge() logic is this:
The Runfiles.mergeAll logic is harder to follow, but I think basically the same: all its builder calls force legacyExternalRunfiles=false.
What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
Expected: the find command lists
external/repo2/r2.txt
Actual: It does not
Which operating system are you running Bazel on?
Linux
What is the output of
bazel info release
?dev
If
bazel info release
returnsdevelopment version
or(@non-git)
, tell us how you built Bazel.bazel build //src:bazel-dev
What's the output of
git remote get-url origin; git rev-parse master; git rev-parse HEAD
?Have you found anything relevant by searching the web?
flag flip for legacy_external_runfiles: #12821
Any other information, logs, or outputs that you want to share?
No response
The text was updated successfully, but these errors were encountered: