Charles-François Natali added the comment:

That's normal.
You're truncating the file after having it mapped, so touching the pages 
corresponding to the truncated part of the file will result in a segfault.
See mmap's man page:
"""
       Use of a mapped region can result in these signals:

       SIGBUS Attempted access to a portion of the buffer that does not 
correspond to
              the file (for example, beyond the end of the file, including the 
case
              where another process has truncated the file).
"""

The only way to guard against it would be to call fstat() in every 
buffer-protocol method in case of file-backed mapping to check against the 
current file size, but that would be awfully slow in case of sequential access 
(just imagine performing an md5sum of an mmap-ed file).

----------
nosy: +neologix

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue16212>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to