You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thanks for the report! This is definitely because of memory mapping. The reason why you're seeing inconsistencies is because memory mapping is enabled by default using heuristics. e.g., If you search a directory, it's always disabled. But if you search a small number of single files, then it's generally enabled.
There is indeed a special case where memory mapping these sorts of files doesn't work. Currently, ripgrep detects this by asking the file size. If the size is 0, then it always uses standard read calls instead of memory maps. Interestingly, it looks like these files do not report a size of 0:
I confess that my file size trick was not informed by what the OS purports to guarantee, but rather, it was informed by observed behavior. It looks like it doesn't work in this case.
I suppose the fix to this is to look at the error returned by opening a memory map, and if it's a "no such device" error, then perhaps we should fallback to normal read calls.
These files were recently added on Linux but it seems they cannot be
mmap()
ed. I'm getting the following error:Disabling
mmap()
works:Weirdly, this works (running on the directory instead of all the files, omitting
*
):The text was updated successfully, but these errors were encountered: