[Python-Dev] test_largefile.py failing on Linux

Charles Cazabon python@discworld.dyndns.org
Mon, 11 Mar 2002 20:14:42 -0600


Tim Peters <tim.one@comcast.net> wrote:
> I can easily enough change the Windows file.truncate() to leave the file
> position alone, although it will *have* to move it if the initial position
> is beyond the truncated size.  I'm baffled by what
> 
>     http://www.opengroup.org/onlinepubs/7908799/xsh/ftruncate.html
> 
> intends by
> 
>     These functions do not modify the file offset for any open file
>     descriptions associated with the file
> 
> in the cases where the current file position is indeed beyond the truncated
> size.  A Unix geek will have to answer that.

It should create a sparse file on the next write to the file, if the file
offset is not changed.  If the platform doesn't support sparse files, it
should be padded with 0 bytes by the OS to the necessary length to allow the
write to take place at the specified offset.

Charles
-- 
-----------------------------------------------------------------------
Charles Cazabon                           <python@discworld.dyndns.org>
GPL'ed software available at:  http://www.qcc.sk.ca/~charlesc/software/
-----------------------------------------------------------------------