`ignore_directories` does not prevent directories from being traversed
Description of the bug:
It appears that ignore_directories does not prevent the directory from being traversed, unlike .bazelignore.
Which category does this issue belong to?
Performance
What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
- Add a large number of files into a directory within the project. (In my particular case, it was a worktree for the project.) For no particular reason, we'll call it
.claude. - Run a build in the worktree, so we also get the
bazel-*symlinks in the worktree.
$ cat REPO.bazel
ignore_directories([".claude"])
$ cat .bazelignore
cat: .bazelignore: No such file or directory
$ bazel shutdown
$ time bazel build -c opt --copt=-UNDEBUG --nobuild --bes_backend= //...
Starting local Bazel server (9.2.0) and connecting to it...
INFO: Invocation ID: aec29ad2-a7ea-4bff-a8c4-3cb955742c7c
INFO: Analyzed 2378 targets (759 packages loaded, 50786 targets configured, 162 aspect applications).
INFO: Found 2378 targets...
INFO: Elapsed time: 14.265s, Critical Path: 0.00s
INFO: 0 processes.
INFO: Build completed successfully, 0 total actions
real 0m14.324s
user 0m0.032s
sys 0m0.031s
$ time bazel build -c opt --copt=-UNDEBUG --nobuild --bes_backend= //...
INFO: Invocation ID: 0af6e5af-3656-4dc4-96bc-177544792c46
INFO: Checking for file changes...
INFO: Analyzed 2378 targets (0 packages loaded, 0 targets configured).
INFO: Found 2378 targets...
INFO: Elapsed time: 22.546s, Critical Path: 0.00s
INFO: 0 processes.
INFO: Build completed successfully, 0 total actions
real 0m22.604s
user 0m0.025s
sys 0m0.041s
$ bazel dump --skyframe=count | sort > /tmp/a
WARNING: This information is intended for consumption by developers only, and may change at any time. Script against it at your own risk!
$ echo '.claude' > .bazelignore
$ bazel shutdown
$ time bazel build -c opt --copt=-UNDEBUG --nobuild --bes_backend= //...
Starting local Bazel server (9.2.0) and connecting to it...
INFO: Invocation ID: 66e712f1-152c-4fde-b4d6-201ebf9d395d
INFO: Analyzed 2378 targets (759 packages loaded, 50786 targets configured, 162 aspect applications).
INFO: Found 2378 targets...
INFO: Elapsed time: 5.233s, Critical Path: 0.00s
INFO: 0 processes.
INFO: Build completed successfully, 0 total actions
real 0m5.294s
user 0m0.031s
sys 0m0.031s
$ time bazel build -c opt --copt=-UNDEBUG --nobuild --bes_backend= //...
INFO: Invocation ID: bfb68ace-f9ce-45de-80f8-c407ed71fad1
INFO: Analyzed 2378 targets (0 packages loaded, 0 targets configured).
INFO: Found 2378 targets...
INFO: Elapsed time: 0.843s, Critical Path: 0.00s
INFO: 0 processes.
INFO: Build completed successfully, 0 total actions
real 0m0.882s
user 0m0.026s
sys 0m0.027s
$ bazel dump --skyframe=count | sort > /tmp/b
WARNING: This information is intended for consumption by developers only, and may change at any time. Script against it at your own risk!
Output of diff /tmp/a /tmp/b:
14,15c14,15
< DIRECTORY_LISTING 327905
< DIRECTORY_LISTING_STATE 309409
---
> DIRECTORY_LISTING 35555
> DIRECTORY_LISTING_STATE 21011
17,18c17,18
< FILE 1529717
< FILE_STATE 1496347
---
> FILE 114937
> FILE_STATE 71419
27c27
< PACKAGE_LOOKUP 329369
---
> PACKAGE_LOOKUP 37019
32c32
< RECURSIVE_PKG 1442124
---
> RECURSIVE_PKG 28448
Which operating system are you running Bazel on?
macOS Tahoe 26.6
What is the output of bazel info release?
release 9.2.0
If bazel info release returns development 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 HEAD ?
$ git remote get-url origin; git rev-parse HEAD
[email protected]:brontosource/repo.git
49c1264e16d3241c7903d215c8eae126193a1ca9
This is unfortunately a private repo.
If this is a regression, please try to identify the Bazel commit where the bug was introduced with bazelisk --bisect.
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
@lberki
A fix for this issue has been included in Bazel 9.3.0 RC1. Please test out the release candidate and report any issues as soon as possible.
If you're using Bazelisk, you can point to the latest RC by setting USE_BAZEL_VERSION=9.3.0rc1. Thanks!
I've confirmed that this appears fixed from our end in 9.3.0rc1. Much appreciated for the quick turnaround!