summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Gallant <jamslam@gmail.com>2021-06-26 12:53:59 -0400
committerAndrew Gallant <jamslam@gmail.com>2021-06-26 12:53:59 -0400
commitfdfc418be55ff91e0c2efad6a3e27db054cb5534 (patch)
treed05c514dfd5fc2195845c206174765434f990ac5
parent5bf74362b93561cad671e747bb1e4b56ac13e129 (diff)
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
-rw-r--r--crates/searcher/src/searcher/mmap.rs10
1 files changed, 10 insertions, 0 deletions
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;