homepage

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\'s resize method resizes the file in win32 but not unix
Type: Stage:
Components: Extension Modules Versions: Python 2.4
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: georg.brandl Nosy List: facundobatista, georg.brandl, georg.brandl, josiahcarlson, loewis, myers_carpenter
Priority: normal Keywords:

Created on 2003年04月27日 17:44 by myers_carpenter, last changed 2022年04月10日 16:08 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
mmap-resize-diff georg.brandl, 2005年06月03日 20:50
Messages (9)
msg15710 - (view) Author: Myers Carpenter (myers_carpenter) Date: 2003年04月27日 17:44
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.
msg15711 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2003年05月04日 12:36
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.
msg15712 - (view) Author: Facundo Batista (facundobatista) * (Python committer) Date: 2005年01月15日 17:55
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
msg15713 - (view) Author: Facundo Batista (facundobatista) * (Python committer) Date: 2005年05月30日 18:59
Logged In: YES 
user_id=752496
Deprecated. Reopen only if still happens in 2.3 or newer. 
. Facundo
msg15714 - (view) Author: Josiah Carlson (josiahcarlson) * (Python triager) Date: 2005年05月30日 23:32
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().
msg15715 - (view) Author: Facundo Batista (facundobatista) * (Python committer) Date: 2005年05月30日 23:51
Logged In: YES 
user_id=752496
Reopened as posted that still is a bug.
msg15716 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2005年06月03日 20:12
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.
msg15717 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2005年06月03日 20:50
Logged In: YES 
user_id=1188172
Attaching patch which duplicates the file handle under UNIX
too (btw, the size() method was broken too), mimics Windows
behaviour with resize(), adds a testcase for this and
clarifies the docs.
msg15718 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2005年08月24日 07:19
Logged In: YES 
user_id=1188172
Okay, committed as
Modules/mmapmodule.c; 2.50; 2.48.4.1
Lib/test/test_mmap.py; 1.33; 1.30.18.1
Doc/lib/libmmap.tex; 1.12; 1.9.4.2
History
Date User Action Args
2022年04月10日 16:08:24adminsetgithub: 38382
2003年04月27日 17:44:53myers_carpentercreate

AltStyle によって変換されたページ (->オリジナル) /