From 4ac817f5ad3f2a6118987c0f82fed9dc320a4347 Mon Sep 17 00:00:00 2001 From: Ladi Prosek Date: Fri, 12 Feb 2021 13:14:01 +0100 Subject: [PATCH] Back-compat workaround --- src/Shared/FileMatcher.cs | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/src/Shared/FileMatcher.cs b/src/Shared/FileMatcher.cs index c31de6d7c80..6628b3025dd 100644 --- a/src/Shared/FileMatcher.cs +++ b/src/Shared/FileMatcher.cs @@ -1061,10 +1061,27 @@ struct RecursionState { return Enumerable.Empty(); } + + // Back-compat hack: We don't use case-insensitive file enumeration I/O on Linux so the behavior is different depending + // on the NeedsToProcessEachFile flag. If the flag is false and matching is done within the _getFileSystemEntries call, + // it is case sensitive. If the flag is true and matching is handled with MatchFileRecursionStep, it is case-insensitive. + // TODO: Can we fix this by using case-insensitive file I/O on Linux? + bool forceFileProcessing = false; + string filespec; + if (NativeMethodsShared.IsLinux && recursionState.SearchData.DirectoryPattern != null) + { + filespec = "*.*"; + forceFileProcessing = true; + } + else + { + filespec = recursionState.SearchData.Filespec; + } + IEnumerable files = _getFileSystemEntries(FileSystemEntity.Files, recursionState.BaseDirectory, - recursionState.SearchData.Filespec, projectDirectory, stripProjectDirectory); + filespec, projectDirectory, stripProjectDirectory); - if (!stepResult.NeedsToProcessEachFile) + if (!forceFileProcessing && !stepResult.NeedsToProcessEachFile) { return files; }