Date: Mon, 19 Apr 1999 14:01:08 +0800
From: David Luyer <[email protected]>
To: [email protected]Subject: truncate("x", -1)
Looks Linux specific from some testing. And doesn't even happen with Linux
NFS to a Linux server.
Digital Unix ADVFS - no problem
Solaris UFS - no problem
Linux 2.0 NFS client against Solaris NFS server (UFS) - no problem
Linux 2.0 NFS client against Linux NFS 2.0 server (EXT2FS) - no problem
Linux 2.0 EXT2FS - PROBLEM
StarOS 4.1.1 TMPFS - no problem
StarOS 4.1.1 UFS - no problem
FreeBSD 3.0 - no problem
NeXTStep 3.3 - no problem
Fortunately, even in the Linux case, it doesn't seem to mess up quotas.
The argument to [f]truncate is meant to be a size_t not a ssize_t, so
probably this is a signed/unsigned bug. The man page says that it should
truncate a file to at most the specified size, so the correct behaviour
should be
truncate("x", -1)
kernel: current size 0 < new size 2^32 - 1
kernel: return success with no action
David.
(NB: StarOS 4.1.1 in the above list is basically SunOS 4.1.1 for one type of
sun4x [the Star 910/VP])