[ python-Bugs-1586414 ] tarfile.extract() may cause file fragmentation on Windows XP

SourceForge.net noreply at sourceforge.net
Thu Dec 21 09:51:01 CET 2006


Bugs item #1586414, was opened at 2006-10-28 23:22
Message generated for change (Settings changed) made by gustaebel
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1586414&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
Private: No
Submitted By: Enoch Julias (enochjul)
>Assigned to: Lars Gustäbel (gustaebel)
Summary: tarfile.extract() may cause file fragmentation on Windows XP

Initial Comment:
When I use tarfile.extract() to extract all the files
from a large tar archive with lots of files tends to
cause file fragmentation in Windows. Apparently NTFS
cluster allocation interacts badly with such operations
if Windows is not aware of the size of each file.

The solution is to use a combination of the Win32 APIs
SetFilePointer() and SetEndOfFile() before writing to
the target file. This helps Windows choose a contiguous
free space for the file.

I tried it on the 2.6 trunk by calling file.truncate()
(which seems to implement the appropriate calls on
Windows) to set the file size before writing to a file.
It helps to avoid fragmentation for the extracted files
on my Windows XP x64 system.

Can this be added to tarfile to improve its performance
on Windows?

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

Comment By: Enoch Julias (enochjul)
Date: 2006-10-31 06:07

Message:
Logged In: YES 
user_id=6071

I submitted patch #1587674 for this, though I am not sure if
it is a good idea to use truncate() for such a purpose.

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

Comment By: Georg Brandl (gbrandl)
Date: 2006-10-29 09:55

Message:
Logged In: YES 
user_id=849994

Can you try to come up with a patch?

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

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


More information about the Python-bugs-list mailing list