Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 13 Jun 1998 15:07:51 +1000
From:      Bruce Evans <bde@zeta.org.au>
To:        phk@critter.freebsd.dk, rivers@dignus.com, zach@gaffaneys.com
Cc:        asami@FreeBSD.ORG, danny@panda.hilink.com.au, freebsd-bugs@FreeBSD.ORG
Subject:   Re: bin/6653
Message-ID:  <199806130507.PAA12399@godzilla.zeta.org.au>

next in thread | raw e-mail | index | archive | help
>I wonder why the nifty trick of:
>
>rm -rf /var/run/.
>
>which used to clear a directory, quit working.

Script started on Sat Jun 13 14:57:14 1998
ttyp0:bde@gamplex:/tmp> mkdir /tmp/foo /tmp/foo/foo
ttyp0:bde@gamplex:/tmp> truss rm -rf /tmp/foo/.
rm: syscall write(2,0xefbfd308,4)
	returns 4 (0x4)
"." and ".." may not be removedsyscall write(2,0xefbfd31c,31)
	returns 31 (0x1f)

syscall write(2,0xefbfd30c,1)
	returns 1 (0x1)
syscall geteuid()
	returns 15 (0xf)
syscall exit(0x1)
	process exit, rval = 256
ttyp0:bde@gamplex:/tmp> 
Script done on Sat Jun 13 14:57:39 1998

rm(1) is "smart" and doesn't trust rmdir(2).

It is also stupid.  It does a simple lexical check for "." and ".." at the
end of the path, `rm -rf /tmp/foo/./' works like you want.

Bruce

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message



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