[ python-Bugs-1480678 ] mmap tries to truncate special files

SourceForge.net noreply at sourceforge.net
Wed May 3 20:19:49 CEST 2006


Bugs item #1480678, was opened at 2006-05-02 16:56
Message generated for change (Comment added) made by aerojockey
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1480678&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Library
Group: Python 2.4
Status: Open
Resolution: None
Priority: 5
Submitted By: Carl Banks (aerojockey)
Assigned to: Nobody/Anonymous (nobody)
Summary: mmap tries to truncate special files

Initial Comment:
One Unix, the resize() method of an mmap object calls
ftruncate to also resize the associated file.  Problem
is, ftruncate fails if the fd refers to a special file.
 This is a problem for someone trying to resize an
anonymous memory map using /dev/zero.

Apparently hasn't been fixed in 2.5 (based on SVN and
changelogs) but I haven't tested it.

----------------------------------------------------------------------

>Comment By: Carl Banks (aerojockey)
Date: 2006-05-03 14:19

Message:
Logged In: YES 
user_id=1515186

Well, since resizing an anonymous array seems a reasonable
thing to do, and because it worked in Python 2.3, I presumed
that the error was an oversight, and not intended behavior.

If it is, in fact, intended behavior, then ok, though I
don't agree with it.  (It's not as if /dev/zero has fixed
size that doesn't change; it's inherently sizeless.)

----------------------------------------------------------------------

Comment By: Tim Peters (tim_one)
Date: 2006-05-03 02:13

Message:
Logged In: YES 
user_id=31435

Ya, this isn't a bug:  resize() is documented as changing
the size of _both_ the map and the file.  If the size of the
file can't be changed, then of course resize() will fail.

aerojockey:  can't you simply close your current map and
create a new map with the size you want?

----------------------------------------------------------------------

Comment By: Neal Norwitz (nnorwitz)
Date: 2006-05-03 01:21

Message:
Logged In: YES 
user_id=33168

I don't understand what the problem is.  ISTM if you resize
a special file an exception will be raised.  Is that not the
case?  What do you expect to happen?

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1480678&group_id=5470


More information about the Python-bugs-list mailing list