mirror of
https://github.com/BurntSushi/ripgrep.git
synced 2025-03-17 20:28:03 +02:00
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
This commit is contained in:
parent
5bf74362b9
commit
fdfc418be5
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user