[issue16212] mmap() dumps core upon resizing the underlying file

2012-10-14 Thread Vladimir Ushakov
Vladimir Ushakov added the comment: > But I think we've talked enough... So do I. Let's go for it. I'll make a patch (which apparently takes some time) and post it here, we'll discuss it then. Thanks for your comments. Now I believe it's a bit harder than I thought

[issue16212] mmap() dumps core upon resizing the underlying file

2012-10-14 Thread Vladimir Ushakov
Vladimir Ushakov added the comment: Update: The correct link to the POSIX definition of longjmp exiting a signal handler as an ISO C extension is http://pubs.opengroup.org/onlinepubs/9699919799/functions/longjmp.html -- ___ Python tracker <h

[issue16212] mmap() dumps core upon resizing the underlying file

2012-10-14 Thread Vladimir Ushakov
Vladimir Ushakov added the comment: > ...it's just impossible to guarantee that Python internal structures are > still consistent. In generic case, I completely agree. Here the things are much simpler (unless I missed something). We know perfectly well the code we need to pr

[issue16212] mmap() dumps core upon resizing the underlying file

2012-10-14 Thread Vladimir Ushakov
Vladimir Ushakov added the comment: > For your specific case, you should... There's nothing I should. As I said above, the bug doesn't trouble me. I just posted it as a generic contribution and don't really care whether it's going to be fixed or not. If decided so,

[issue16212] mmap() dumps core upon resizing the underlying file

2012-10-14 Thread Vladimir Ushakov
Vladimir Ushakov added the comment: SIGBUS as well as SIGFPE or SIGSEGV is a synchronous signal. It is delivered to the thread that caused the trouble and the stack contents is well defined. > https://www.securecoding.cert.org/confluence/display/seccode/SIG35-C.+Do+not+return+from+SIGS

[issue16212] mmap() dumps core upon resizing the underlying file

2012-10-13 Thread Vladimir Ushakov
Vladimir Ushakov added the comment: > You can't use longjmp from signal handlers. Well, you can, but 99% of the > code that does it is broken, because you can only call async-safe functions > from within a signal handler, and certainly can't run the intepreter. I don'

[issue16212] mmap() dumps core upon resizing the underlying file

2012-10-13 Thread Vladimir Ushakov
Vladimir Ushakov added the comment: I know how to avoid the problem in my case, the bug does not really affect me. I posted it because I thought that the possibility to crash the interpreter is something to be avoided at all costs. I've found a few examples of handling non-restartable si

[issue16212] mmap() dumps core upon resizing the underlying file

2012-10-12 Thread Vladimir Ushakov
Vladimir Ushakov added the comment: I think, handling the signal would do. -- ___ Python tracker <http://bugs.python.org/issue16212> ___ ___ Python-bugs-list m

[issue16212] mmap() dumps core upon resizing the underlying file

2012-10-12 Thread Vladimir Ushakov
New submission from Vladimir Ushakov: The following code crashes the interpreter on Linux: #!/usr/bin/python3 import mmap with open('test', 'wb') as f: f.write(bytes(1)) with open('test', 'r+b') as f: m = mmap.mmap(f.fileno(), 0) f.truncat