Issue462783
This issue tracker has been migrated to GitHub,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2001-09-19 07:31 by dalke, last changed 2022-04-10 16:04 by admin. This issue is now closed.
Messages (5) | |||
---|---|---|---|
msg6578 - (view) | Author: Andrew Dalke (dalke) * | Date: 2001-09-19 07:31 | |
Not using the mmap module correctly can cause a bus error under Linux. This is a DEC, err, Compaq, err, HP Alpha. Here's a reproducible. The problem appears to be trying to mmap past the end of the file, since putting in a "seek(0)" at the indicated spot fixes things. [dalke@pw600a src]$ ./python Python 2.2a3+ (#6, Sep 17 2001, 05:05:24) [GCC egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> file = open("test.dat", "w+") >>> file.write("12345") >>> import mmap >>> # Forgot to do "file.seek(0)" here >>> s = mmap.mmap(file.fileno(), 5) >>> s[:5] Bus error [dalke@pw600a src]$ gdb ./python core GNU gdb 19991004 Copyright 1998 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "alpha-redhat-linux"... warning: "/home/dalke/cvses/python/dist/src/core": ambiguous core format, 2 handle rs match warning: core file may not match specified executable file. Core was generated by `perl'. Program terminated with signal 8, Floating point exception. #0 0x12004d7b8 in com_assert_stmt (c=0x0, n=0x0) at Python/compile.c:717 717 PyString_AsString(c->c_code)[c- >c_nexti++] = byte; (gdb) where #0 0x12004d7b8 in com_assert_stmt (c=0x0, n=0x0) at Python/compile.c:717 (gdb) Andrew dalke@dalkescientific.com |
|||
msg6579 - (view) | Author: Jeremy Hylton (jhylton) | Date: 2001-10-22 23:37 | |
Logged In: YES user_id=31392 I can reproduce the problem just fine on Intel Linux, but I'm not really sure what we can do about it. When I run the test, I get a bus error when it tries to dereference self->data in mmap_slice(). I don't see how we can prevent the bus error short of checking the length of the file before we map it. |
|||
msg6580 - (view) | Author: Guido van Rossum (gvanrossum) * | Date: 2002-04-04 17:22 | |
Logged In: YES user_id=6380 Note that Greg Green has uploaded a fix for this, patch 536578. Andrew, can you test that patch? |
|||
msg6581 - (view) | Author: Andrew Dalke (dalke) * | Date: 2002-04-05 12:04 | |
Logged In: YES user_id=190903 The patch (against current CVS as of 2002 April 05) passes the regression above, by raising an OSError exception instead of giving a bus error, which is the case without the patch. I don't know enough about mmap, but the code and explanation looks reasonable. The exception text given is good enough that I could figure out how to fix my problem/misunderstanding. The regression test tests this bug. However, there is a small typo in the patch to test_mmap.py. Line 277 says ... not in ('win32'): when it should say ... not in ('win32', ): +1 on accepting the gist of this patch (with this fix). |
|||
msg6582 - (view) | Author: Neal Norwitz (nnorwitz) * | Date: 2002-09-12 03:39 | |
Logged In: YES user_id=33168 This bug was fixed by fixing bug 585792. |
History | |||
---|---|---|---|
Date | User | Action | Args |
2022-04-10 16:04:27 | admin | set | github: 35202 |
2001-09-19 07:31:30 | dalke | create |