Subject: kern/34448: NFS fails with creat(...,0)
To: None <,,>
From: None <>
List: netbsd-bugs
Date: 09/01/2006 21:15:01
>Number:         34448
>Category:       kern
>Synopsis:       NFS fails to ftruncate() after creat(...,0)
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Sep 01 21:15:00 +0000 2006
>Originator:     Michael van Elst
>Release:        NetBSD 3.1_RC1
                                Michael van Elst
                                "A potential Snark may lurk in every tree."
System: NetBSD henery 3.1_RC1 NetBSD 3.1_RC1 (HENERY) #35: Wed Aug 23 23:44:43 CEST 2006 src@henery:/usr/obj/home/src/sys/arch/i386/compile/HENERY i386
Architecture: i386
Machine: i386
On UNIX filesystems you can creat() a file with mode 0 (either by
specifying a mode argument of 0 or by using a umask of 777) but
still access the created file through the newly opened file handle.
An NFS server emulates this behaviour by ignoring permissions for
file operations when the file is accessed by its owner.

On NetBSD this fails when the subsequent operation is ftruncate().
As a result the iozone benchmark program fails.


use Fcntl;

sysopen F,"foo",O_RDWR|O_CREAT,0
        or die "sysopen: $!\n";
truncate F,0
        or die "truncate: $!\n";