Subject: Re: Little prob with rm
To: Christos Zoulas <christos@deshaw.com>
From: Greg A. Woods <woods@kuma.web.net>
List: current-users
Date: 10/31/1994 13:14:03
[ On Sat, October 29, 1994 at 00:05:53 (GMT), Christos Zoulas wrote: ]
> Subject: Re: Little prob with rm
>
> This is not exactly true. Namei() was changed in SVR4 and other posix
> machines (and semi posix machines including sunos >= 4.1.3)
> to ignore any number of trailing slashes. This is not a great
> thing. Consider:
>
> % rm -fr foo
> % cat > foo/
> bar baz
> ^D
> % echo */
Regardless of what namei() is doing, it is not the "problem" on
NetBSD-1.0. This is the partial output of ktrace/kdump on "rm -rf
/tmp/foo/", where this sub-directory included a file "bar":
24056 rm CALL unlink(0x23140)
24056 rm NAMI "bar"
24056 rm RET unlink 0
24056 rm CALL fchdir(0x3)
24056 rm RET fchdir 0
24056 rm CALL rmdir(0x22000)
24056 rm NAMI "/tmp/foo/"
24056 rm RET rmdir -1 errno 21 Is a directory
IMHO, rmdir(2) should strip trailing slashes, as per almost any other
system call (eg. open(2)) which collapses multiple slashes to one, and
also permits trailing slashes.
Otherwise, the manual page for rmdir(2) should include a note about
EISDIR being a valid error.
--
Greg A. Woods
+1 416 443-1734 VE3TCP robohack!woods
Planix, Inc. <woods@planix.com>; UniForum Canada <woods@uniforum.ca>