Automated rollback of commit 16465d7613348e39e0bcdb22697cf67d257a3d91.
*** Reason for rollback ***
We need to reconsider this.
https://devblogs.microsoft.com/commandline/per-directory-case-sensitivity-and-wsl/ says case-sensitivity can be set per-directory. Requiring correct casing for every directory would make Bazel behave the same on Linux and Windows, and work with WSL-created paths.
*** Original change description ***
glob() now supports case-insensitive mode
The behavior is triggered by
FileSystem.isGlobCaseSensitive() returning false.
None of the production FileSystem implementaitions
return false yet, only some test implementations.
Motivation is to support case-insensitive glob()
on Windows.
See https://github.com/bazelbuild/bazel/issues/8705 and https://github.com/bazelbuild/bazel/issues/8759.
Next we need to add an incompatible flag that
enables this behavior, and add a relevant bit to
the WindowsFileSystem. See https://github.com/bazelbuild/bazel/issues/8767
We must also warn the user somehow if enabling
this feature would change the result of some
globs. A potential approach would be to glob
case-sensitively and case-insensitively at the
same time and warn the user if the results are
different.
PiperOrigin-RevId: 256556254
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/GlobFunction.java b/src/main/java/com/google/devtools/build/lib/skyframe/GlobFunction.java
index e40c76f..cabb54f 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/GlobFunction.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/GlobFunction.java
@@ -43,10 +43,6 @@
*/
public final class GlobFunction implements SkyFunction {
- // TODO(laszlocsomor): we might need to create another regexPatternCache for case-insensitive
- // glob() mode to avoid reading wrong cache results when the user changes the
- // --incompatible_windows_case_ignoring_glob flag value between builds.
- // See https://github.com/bazelbuild/bazel/issues/8767.
private final ConcurrentHashMap<String, Pattern> regexPatternCache = new ConcurrentHashMap<>();
private final boolean alwaysUseDirListing;
@@ -156,11 +152,6 @@
}
}
- // TODO(laszlocsomor): set `caseSensitive` from the value of
- // `--incompatible_windows_case_insensitive_glob` or from FileSystem.isGlobCaseSensitive()
- // See https://github.com/bazelbuild/bazel/issues/8767
- final boolean caseSensitive = true;
-
// Now that we have the directory listing, we do three passes over it so as to maximize
// skyframe batching:
// (1) Process every dirent, keeping track of values we need to request if the dirent cannot
@@ -178,7 +169,7 @@
for (Dirent dirent : listingValue.getDirents()) {
Dirent.Type direntType = dirent.getType();
String fileName = dirent.getName();
- if (!UnixGlob.matches(patternHead, fileName, regexPatternCache, caseSensitive)) {
+ if (!UnixGlob.matches(patternHead, fileName, regexPatternCache)) {
continue;
}