[10261] in bugtraq

home help back first fref pref prev next nref lref last post

truncate("x", -1)

daemon@ATHENA.MIT.EDU (David Luyer)
Mon Apr 19 14:24:36 1999

Date: 	Mon, 19 Apr 1999 14:01:08 +0800
Reply-To: David Luyer <luyer@UCS.UWA.EDU.AU>
From: David Luyer <luyer@UCS.UWA.EDU.AU>
To: BUGTRAQ@NETSPACE.ORG

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])

home help back first fref pref prev next nref lref last post