[lkml]   [1997]   [Jan]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Subjectrmdir removes plain files over NFS
The rmdir() call should return "Not a directory" when asked to remove a
plain file. Over NFS it deletes it.


beard$: touch /tmp/tmpFile
beard$: rmdirBug /tmp/tmpFile
rmdir returned: -1
rmdirBug: Not a directory

beard$ touch /amd/spud/export/home/spud5/ajr/tmpFile
beard$ rmdirBug /amd/spud/export/home/spud5/ajr/tmpFile
rmdir returned: 0

strace confirms that rmdir() is returnign 0:

beard ajr: strace rmdirBug /amd/spud/export/home/spud5/ajr/tmpFile
getegid() = 16000
rmdir("/amd/spud/export/home/spud5/ajr/tmpFile") = 0
fstat(1, {st_mode=S_IFCHR|0620, st_rdev=makedev(4, 193), ...}) = 0

/amd/spud/export/home/spud5/ajr is my amd automounted home directory:

beard$ mount
/dev/hda3 on / type ext2 (rw)
/proc on /proc type proc (rw)
beard:(pid123) on /home type auto
spud:/export/home/spud5 on /amd/spud/export/home/spud5 type nfs (rw)

The source to rmdirBug is simply:

beard: cat rmdirBug.c
# include <stdio.h>

int main(int argc, char **argv) {
int retVal;

/* should set errno to ENOTDIR for files */
retVal = rmdir(argv[1]);

printf("rmdir returned: %d\n", retVal);

if(retVal != 0)


which was written as I originally thought the problem was in /bin/rmdir.

The machine beard, used in the example above is a dual processor Pentium
Pro recently installed with Debian 1.2.4. It is running kernel version

I first noticed the problem about a month ago on a Pentium running
2.0.27 and various versions of Debian. This bug has been run though the
various Debian bug lists (Bug#5945) before being reported here.

Tony Robinson

Fax +44-1223-740026

 \ /
  Last update: 2005-03-22 13:38    [W:0.021 / U:3.108 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site