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: mmap.write_byte out of bounds - no error, position gets screwed up
Type: behavior Stage:
Components: Versions: Python 2.6
process
Status: closed Resolution: out of date
Dependencies: Superseder:
Assigned To: Nosy List: bmearns, ocean-city
Priority: normal Keywords:

Created on 2009-04-30 18:28 by bmearns, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (5)
msg86848 - (view) Author: Brian Mearns (bmearns) Date: 2009-04-30 18:28
Created an mmap for a file in update mode, seek to end of file, and
invoke write_byte. The file is not updated (as expected), but did not
get any error indicating the write was out of bounds, and when I invoke
tell(), it reports a position that is out of bounds. I check size(), and
it still reports the correct size (less than the value reported by
tell()). If I do seek(0, os.SEEK_END), it correctly returns to the end
of the map, instead of this bizarre no-mans land beyond the end.

This is on Windows XP.

Here's an example from the shell. (note that write() works as I would
expect, it raises an exception and doesn't modify the position):

>>> map.tell()
0
>>> map.size()
8
>>> map.seek(0, os.SEEK_END)
>>> map.tell()
8
>>> map.write("foo")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: data out of range
>>> map.tell()
8
>>> map.size()
8
>>> map.write_byte('x')
>>> map.tell()
9
>>> map.size()
8
>>> print "WTF?"
WTF?
>>> map.write_byte('x')
>>> map.tell()
10
>>> map.size()
8
>>> map.flush()
1
>>> map.size()
8
>>> map.tell()
10
>>> map.seek(0, os.SEEK_END)
>>> map.tell()
8
>>> map.size()
8
>>>
msg86869 - (view) Author: Hirokazu Yamamoto (ocean-city) * (Python committer) Date: 2009-05-01 08:34
Can you try this with Python2.6.2? I believe this bug got fixed.
msg87327 - (view) Author: Brian Mearns (bmearns) Date: 2009-05-06 12:37
Confirmed fixed in python 2.6.2
msg87328 - (view) Author: Hirokazu Yamamoto (ocean-city) * (Python committer) Date: 2009-05-06 12:51
Thank you for response. I'll close this entry.
msg87329 - (view) Author: Brian Mearns (bmearns) Date: 2009-05-06 13:01
On Wed, May 6, 2009 at 8:51 AM, Hirokazu Yamamoto
<report@bugs.python.org> wrote:
>
> Hirokazu Yamamoto <ocean-city@m2.ccsnet.ne.jp> added the comment:
>
> Thank you for response. I'll close this entry.
>
> ----------
> resolution:  -> out of date
> status: open -> closed
>

Ok, thanks. I wasn't sure if I should close it or not.
History
Date User Action Args
2022-04-11 14:56:48adminsetgithub: 50137
2009-05-06 13:01:18bmearnssetmessages: + msg87329
2009-05-06 12:51:31ocean-citysetstatus: open -> closed
resolution: out of date
messages: + msg87328
2009-05-06 12:37:13bmearnssetmessages: + msg87327
2009-05-01 08:34:21ocean-citysetnosy: + ocean-city
messages: + msg86869
2009-04-30 18:28:18bmearnscreate