Charles-François Natali <neolo...@free.fr> added the comment:

Trying to revive this issue.
I'm +1 on this change: duping the file descriptor is definitely unexpected and 
has some side effects.
I think we should remove the call to dup and close, it's really the user's 
responsibility to avoid closing the FD.
If the FD is closed when mmap_resize is called, ftruncate will fail with EBADF, 
without harm.
The real problem is more if the file has been closed and another one got open, 
with the same FD.
If we wanted to be paranoid and avoid truncating/re-mapping another file, we 
could store the struct stat's st_ino field when the mapping is created, and 
re-check its value in mmap_resize (and if we wanted to be really paranoid we 
could also store st_dev, because inodes are unique only within a given file 
system).

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

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

Reply via email to