[ python-Bugs-728515 ] mmap's resize method resizes the file in win32 but not unix

SourceForge.net noreply at sourceforge.net
Fri Jun 3 22:12:22 CEST 2005


Bugs item #728515, was opened at 2003-04-27 19:44
Message generated for change (Comment added) made by birkenfeld
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=728515&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: Extension Modules
Group: Python 2.4
Status: Open
Resolution: None
Priority: 5
Submitted By: Myers Carpenter (myers_carpenter)
Assigned to: Nobody/Anonymous (nobody)
Summary: mmap's resize method resizes the file in win32 but not unix

Initial Comment:
In the resize method under win32 you have something
like this:

	/* Move to the desired EOF position */
        SetFilePointer (self->file_handle,
                new_size, NULL, FILE_BEGIN);
        /* Change the size of the file */
        SetEndOfFile (self->file_handle);

Which resizes the file

Under Unix you need to call 

   ftruncate(self->fileno, new_size)

before calling remap() to make it do the same thing.


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

>Comment By: Reinhold Birkenfeld (birkenfeld)
Date: 2005-06-03 22:12

Message:
Logged In: YES 
user_id=1188172

This is not trivial since the filehandle can be closed at
the time the ftruncate() would be necessary.

The Windows specific code duplicates the filehandle upon
mmap creation, perhaps the UNIX code should do this too?
Then, the ftruncate call can be inserted.

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

Comment By: Facundo Batista (facundobatista)
Date: 2005-05-31 01:51

Message:
Logged In: YES 
user_id=752496

Reopened as posted that still is a bug.

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

Comment By: Josiah Carlson (josiahcarlson)
Date: 2005-05-31 01:32

Message:
Logged In: YES 
user_id=341410

The problem still persists in Python 2.3 and 2.4.  A quick
read of mmapmodule.c shows that ftruncate() is not being
called within the non-windows portion of mmap_resize_method().

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

Comment By: Facundo Batista (facundobatista)
Date: 2005-05-30 20:59

Message:
Logged In: YES 
user_id=752496

Deprecated. Reopen only if still happens in 2.3 or newer. 

.    Facundo

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

Comment By: Facundo Batista (facundobatista)
Date: 2005-01-15 18:55

Message:
Logged In: YES 
user_id=752496

Please, could you verify if this problem persists in Python 2.3.4
or 2.4?

If yes, in which version? Can you provide a test case?

If the problem is solved, from which version?

Note that if you fail to answer in one month, I'll close this bug
as "Won't fix".

Thank you! 

.    Facundo

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

Comment By: Martin v. Löwis (loewis)
Date: 2003-05-04 14:36

Message:
Logged In: YES 
user_id=21627

Would you like to contribute a patch? Please make sure to
include changes to the documentation and test suite.

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

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


More information about the Python-bugs-list mailing list