Subject: Re: ftruncate(2) and length bigger than filesize
To: None <tech-kern@netbsd.org>
From: Guenther Grau <Guenther.Grau@marconicomms.com>
List: tech-kern
Date: 04/20/2000 13:27:08
"PER4MANCE, J. Dolecek" wrote:
>
> Hi,
> if ftruncate() is called with parameter "length" longer
> than current file size, the traditional BSD way
> (at least by manpage) seems to be not do anything,
> i.e. leave the file size lower than the supplied "length".
>
> Now, ffs and msdosfs at least do extend the file
> appropriately, so that the length is really _set_
> to the supplied length. lfs doesn't extend the file.
> This should be consistent.
>
> Some software depends on extending behaviour od ftruncate(2),
> e.g. emacs (see kern/9926). This is even documented
> behaviour on Solaris.
>
> What is "right" here ? Should we fix those filesystem which
> do not extend the file in ftuncate(2) and adapt manpage
> accordingly, or "fix" the ffs and msdosfs and maybe others
> so that they don't extend the file if length passed
> to ftruncate(2) is longer than file size ?
IMHO, we should go the Solaris way, as most of the
filesystems already behaved that way. Just change the
documentation and fix lfs.
Just my 2 cents...
Guenther