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.

classification
Title: patch for bug 462783 mmap bus error
Type: Stage:
Components: Extension Modules Versions: Python 2.3
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: nnorwitz Nosy List: gpgreen, gvanrossum, nnorwitz
Priority: normal Keywords: patch

Created on 2002-03-29 03:02 by gpgreen, last changed 2022-04-10 16:05 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
patch gpgreen, 2002-03-29 03:02 patch for bug 462783
Messages (4)
msg39406 - (view) Author: Greg Green (gpgreen) Date: 2002-03-29 03:02
This patch fixes SF 462783. The problem was that an
mmap'ed file caused a bus error when reading data from
the file. The root cause is that the file wasn't
flushed following a write. The patched module will
throw an OSError exception if the mmap object was
created without being flushed, fseek'ed, or closed,
following a write. This patch only applies to unix
systems. Windows seems to handle the condition ok.

The problem with the patch is that existing code can be
broken. On some systems, (FreeBSD, irix), as long as
the file was flushed before attempting to read from the
mmap object, it would work with no bus error. Linux
gets a bus error no matter what. So existing code that
did flush (or fseek) before a read will now get an
OSError exception during mmap creation instead.

I tried this on the cvs version of python 2.3, on linux
redhat 7.2, FreeBSD 4.5, irix 6.5 n32, and windows 2000.

-- Greg Green
msg39407 - (view) Author: Greg Green (gpgreen) Date: 2002-03-29 18:49
Logged In: YES 
user_id=499627

my email is gregory.p.green@boeing.com
msg39408 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2002-04-05 15:18
Logged In: YES 
user_id=6380

One comment from Andrew Dalke (who submitted bug 462783)
about the patch: There's a small typo in the patch to
test_mmap.py.  Line 277 says
  ... not in ('win32'):
when it should say
  ... not in ('win32', ):

(Personally, I'd write ... != 'win32' or ... not in
['win32'] --GvR)

Assigning to AMK since it's his module.
msg39409 - (view) Author: Neal Norwitz (nnorwitz) * (Python committer) Date: 2002-09-12 03:42
Logged In: YES 
user_id=33168

Greg, thanks for the patch.  Unfortunately, I didn't notice
this patch or the original bug report until after fixing bug
585792.
History
Date User Action Args
2022-04-10 16:05:10adminsetgithub: 36352
2002-03-29 03:02:19gpgreencreate