Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 28 Nov 1995 05:30:08 +1100
From:      Bruce Evans <bde@zeta.org.au>
To:        freebsd-hackers@freebsd.org, peter@haywire.dialix.com
Subject:   Re: How can I remove hard links between directories?
Message-ID:  <199511271830.FAA20667@godzilla.zeta.org.au>

next in thread | raw e-mail | index | archive | help
>Otherwise, we get bogons like netscape2 doing 'rename(".netscape/",
>".netscape.bak");' or something bogus like that, and the namei()
>lookup is or was converting ".netscape/" to mean ".netscape/." and was

Lookup now converts "foo/" to "foo" if foo is a directory and fails
otherwise.

>pulling "." out of the .netscape directory in root's home (assuming
>somebody was insane enough to run netscape as root.. :-)

>or some bogon inside "rdistd" running as root, renaming the "." files
>if you gave it a bogus distfile..

Renaming of "." and ".." has always been disallowed in FreeBSD.  It
isn't possible to create a damaged tree using rename() (modulo bugs).
Renaming directories "by hand" using link() and unlink() is of course
dangerous.

>or things like inn's fastrm program that have to test if the euid ==
>0, and if so, it has to stat() every single file it's processing to
>make sure it's not about to unlink a directory and running much slower
>from the extra overhead..  (side note, always expire news as uid
>"news" for this very reason).

Why would it be much slower?  unlink() is very slow if writes are
synchronous.  Here repeated stats of the same file take 81 usec while
creat+close+unlink of the same file takes 5000 usec.

Bruce



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199511271830.FAA20667>