mirror of
https://github.com/facebook/sapling.git
synced 2024-10-09 00:14:35 +03:00
hg: on Windows, use mmap with explicit ACCESS_READ argument passed
Summary: On Windows, the intended access to the file handle must align with the intended access to the memory mapping object, see [1]. When called without and argument, Python's `mmap.mmap` on Windows assumes `ACCESS_WRITE` mode[3], therefore we get failures like [2] in Lego Windows. [1] https://msdn.microsoft.com/en-us/library/windows/desktop/aa366537(v=vs.85).aspx [2] P59034213 [3] https://docs.python.org/2/library/mmap.html Reviewed By: quark-zju Differential Revision: D6952583 fbshipit-source-id: 93159f8282e27d3e62d859f4c220e7c3bdfbe958
This commit is contained in:
parent
f5924da1d3
commit
6f179126c7
@ -338,9 +338,11 @@ class basepack(versionmixin):
|
||||
# TODO: use an opener/vfs to access these paths
|
||||
with util.posixfile(self.indexpath, PACKOPENMODE) as indexfp:
|
||||
# memory-map the file, size 0 means whole file
|
||||
self._index = litemmap.mmap(indexfp.fileno(), 0)
|
||||
self._index = litemmap.mmap(indexfp.fileno(), 0,
|
||||
access=litemmap.pymmap.ACCESS_READ)
|
||||
with util.posixfile(self.packpath, PACKOPENMODE) as datafp:
|
||||
self._data = litemmap.mmap(datafp.fileno(), 0)
|
||||
self._data = litemmap.mmap(datafp.fileno(), 0,
|
||||
access=litemmap.pymmap.ACCESS_READ)
|
||||
|
||||
self._pagedin = 0
|
||||
return True
|
||||
|
Loading…
Reference in New Issue
Block a user