Mercurial > public > mercurial-scm > hg-stable
diff mercurial/revlog.py @ 51650:d6c895e4adc4 stable
mmap: only use mmap to read revlog index if it is safe
Cf `is_mmap_safe` docstring.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Wed, 03 Jul 2024 12:26:57 +0200 |
parents | 1721d983dd6d |
children | df6ce326936f |
line wrap: on
line diff
--- a/mercurial/revlog.py Wed Jul 03 12:22:48 2024 +0200 +++ b/mercurial/revlog.py Wed Jul 03 12:26:57 2024 +0200 @@ -1460,7 +1460,10 @@ with self.opener(filepath) as fp: if mmap_threshold is not None: file_size = self.opener.fstat(fp).st_size - if file_size >= mmap_threshold: + if ( + file_size >= mmap_threshold + and self.opener.is_mmap_safe(filepath) + ): if size is not None: # avoid potentiel mmap crash size = min(file_size, size)