Subject: ftruncate(2) and length bigger than filesize
To: None <email@example.com>
From: PER4MANCE, J. Dolecek <firstname.lastname@example.org>
Date: 04/20/2000 12:32:49
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 ?