From fdfc418be55ff91e0c2efad6a3e27db054cb5534 Mon Sep 17 00:00:00 2001 From: Andrew Gallant Date: Sat, 26 Jun 2021 12:53:59 -0400 Subject: searcher: disable mmap searching on non-64 bit It looks like it's possible for mmap to succeed on 32-bit systems even when the full file can't be addressed in memory. This used to work prior to ripgrep 13, but (maybe) something about statically linking vcruntime has caused this to now fail. It's no big deal to disable mmap searching on 32-bit, so we just do that instead of returning incorrect results. Fixes #1911 --- crates/searcher/src/searcher/mmap.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/crates/searcher/src/searcher/mmap.rs b/crates/searcher/src/searcher/mmap.rs index 0ab2d53f..83fc4230 100644 --- a/crates/searcher/src/searcher/mmap.rs +++ b/crates/searcher/src/searcher/mmap.rs @@ -71,6 +71,16 @@ impl MmapChoice { if !self.is_enabled() { return None; } + if !cfg!(target_pointer_width = "64") { + // For 32-bit systems, it looks like mmap will succeed even if it + // can't address the entire file. This seems to happen at least on + // Windows, even though it uses to work prior to ripgrep 13. The + // only Windows-related change in ripgrep 13, AFAIK, was statically + // linking vcruntime. So maybe that's related? But I'm not sure. + // + // See: https://github.com/BurntSushi/ripgrep/issues/1911 + return None; + } if cfg!(target_os = "macos") { // I guess memory maps on macOS aren't great. Should re-evaluate. return None; -- cgit v1.2.3