Fix --remote_download_regex matching all files unconditionally#3301
Merged
brentleyjones merged 1 commit intomainfrom Apr 10, 2026
Merged
Fix --remote_download_regex matching all files unconditionally#3301brentleyjones merged 1 commit intomainfrom
--remote_download_regex matching all files unconditionally#3301brentleyjones merged 1 commit intomainfrom
Conversation
The regex pattern `.*|.*\.(ext1|ext2|...)$` matches everything because `.*` before `|` is an unbounded wildcard with no anchor. This makes the extension filter useless, causing all remote cache outputs to be downloaded. Remove the `.*|` so only files with the listed extensions (plus indexstores when enabled) are downloaded. Signed-off-by: Ryo Aoyama <r.fe51028.r@gmail.com>
0a2665d to
357bf2d
Compare
Member
Author
|
Note: This fix addresses the remote cache download path. For local builds, the storage bloat is primarily caused by linked product binaries produced by the |
brentleyjones
approved these changes
Apr 10, 2026
Contributor
brentleyjones
left a comment
There was a problem hiding this comment.
Thanks for this fix! This clearly regressed in 4a02abb where I only moved part of the regex into the variable.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fix a bug in
generate_index_build_bazel_dependencies.shwhere the--remote_download_regexpattern matches all files unconditionally, defeating the purpose of selective downloads during Index Build.Problem
The current regex:
The
.*|at the boundary acts as an unbounded wildcard. Due to regex OR semantics, it matches every file before the alternation is even evaluated. This means all remote cache outputs are downloaded locally during Index Build, regardless of file extension.The intent was to download only indexstores (matched by
${indexstores_regex}) and files with indexing-relevant extensions (.swiftmodule,.swiftdoc,.swift, headers, etc.). Instead, every output, including.ofiles, intermediate artifacts, and linked binaries, is downloaded.Fix
Remove the erroneous
.*|so the regex correctly constrains downloads to indexstores and listed extensions only:Impact
In a large-scale monorepo, this bug caused Index Build's local storage to grow from an expected few GB to over 1TB, as all remote cache outputs were downloaded unconditionally. With the fix, only indexing-relevant files are downloaded.
Related