Skip to content

Commit c3982cd

Browse files
committed
Add --experimental_check_non_output_external_files option
This option disables the code path that checks so-called "non-output external" files. Some debugging shows that these are files supplied by the host, eg. files under /usr/bin/ and files under the install root. It's puzzling why files under the install root need to be checked for changes, as the bazel launcher also checks for timestamp changes, but I couldn't work out from where these file checks are scheduled, but requests for information in Bazel slack went unanswered (https://bazelbuild.slack.com/archives/CEH3YH9RC/p1745491096584379) Following the example of the --experimental_check_external_repository_files --experimental_check_output_files flags, there is no test. Addresses #25954. RELNOTES: File change checks for non-output external files (host files and embedded tools) can now be disabled with the `--experimental_check_non_output_external_files` flag.
1 parent 9c44416 commit c3982cd

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

src/main/java/com/google/devtools/build/lib/pkgcache/PackageOptions.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,15 @@ public ParallelismConverter() throws OptionsParsingException {
188188
+ "previous run's cache.")
189189
public boolean checkOutputFiles;
190190

191+
@Option(
192+
name = "experimental_check_non_output_external_files",
193+
defaultValue = "true",
194+
documentationCategory = OptionDocumentationCategory.UNDOCUMENTED,
195+
effectTags = {OptionEffectTag.UNKNOWN},
196+
help =
197+
"Check for modifications made to the non-output external files (install root, host files)")
198+
public boolean checkNonOutputExternalFiles;
199+
191200
/** A converter from strings containing comma-separated names of packages to lists of strings. */
192201
public static class CommaSeparatedPackageNameListConverter
193202
extends Converter.Contextless<List<PackageIdentifier>> {

src/main/java/com/google/devtools/build/lib/skyframe/SkyframeExecutor.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3567,6 +3567,7 @@ protected WorkspaceInfoFromDiff handleDiffs(
35673567
pathEntriesWithoutDiffInformation,
35683568
options.getOptions(PackageOptions.class).checkOutputFiles,
35693569
repoOptions != null && repoOptions.checkExternalRepositoryFiles,
3570+
options.getOptions(PackageOptions.class).checkNonOutputExternalFiles,
35703571
fsvcThreads);
35713572
}
35723573
handleClientEnvironmentChanges();
@@ -3643,6 +3644,7 @@ protected void handleDiffsWithMissingDiffInformation(
36433644
Set<Pair<Root, ProcessableModifiedFileSet>> pathEntriesWithoutDiffInformation,
36443645
boolean checkOutputFiles,
36453646
boolean checkExternalRepositoryFiles,
3647+
boolean checkNonoutputExternalFiles,
36463648
int fsvcThreads)
36473649
throws InterruptedException, AbruptExitException {
36483650

@@ -3651,7 +3653,7 @@ protected void handleDiffsWithMissingDiffInformation(
36513653
|| (checkOutputFiles && externalFilesKnowledge.anyOutputFilesSeen)
36523654
|| (checkExternalRepositoryFiles && repositoryHelpersHolder != null)
36533655
|| (checkExternalRepositoryFiles && externalFilesKnowledge.anyFilesInExternalReposSeen)
3654-
|| externalFilesKnowledge.tooManyNonOutputExternalFilesSeen) {
3656+
|| (checkNonoutputExternalFiles && externalFilesKnowledge.tooManyNonOutputExternalFilesSeen)) {
36553657
// We freshly compute knowledge of the presence of external files in the skyframe graph. We
36563658
// use a fresh ExternalFilesHelper instance and only set the real instance's knowledge *after*
36573659
// we are done with the graph scan, lest an interrupt during the graph scan causes us to
@@ -3731,7 +3733,7 @@ protected void handleDiffsWithMissingDiffInformation(
37313733
// think the graph needs to be scanned.
37323734
externalFilesHelper.setExternalFilesKnowledge(
37333735
tmpExternalFilesHelper.getExternalFilesKnowledge());
3734-
} else if (!externalFilesKnowledge.nonOutputExternalFilesSeen.isEmpty()) {
3736+
} else if (checkNonoutputExternalFiles && !externalFilesKnowledge.nonOutputExternalFilesSeen.isEmpty()) {
37353737
logger.atInfo().log(
37363738
"About to scan %d external files",
37373739
externalFilesKnowledge.nonOutputExternalFilesSeen.size());

0 commit comments

Comments
 (0)