Date: Wed, 10 Apr 2002 17:13:19 -0700 From: Terry Lambert <tlambert2@mindspring.com> To: "Brian T.Schellenberger" <bts@babbleon.org> Cc: Peter Kieser <pfak@telus.net>, sthaug@nethelp.no, freebsd-hackers@FreeBSD.ORG Subject: Re: 'rm' incompatibility with Posix.2 Message-ID: <3CB4D51F.A4473F9C@mindspring.com> References: <20020410160038.GA71167@reiher.informatik.uni-wuerzburg> <38103.1018458226@verdi.nethelp.no> <009c01c1e0db$a631dd70$6401a8c0@xeon> <20020410231803.616D4BB39@i8k.babbleon.org>
next in thread | previous in thread | raw e-mail | index | archive | help
"Brian T.Schellenberger" wrote: > On Wednesday 10 April 2002 06:04 pm, Peter Kieser wrote: > | I say we just leave it how it is now. Else alot of people are probably > | going to end up deleting directories by accident. It's perfectly fine how > | it is, if it's not broken why fix it? > > Well, the question is whether it's broken; > > and right now it FreeBSD sometimes deletes directories; the request is to > delete the link instead under those circumstances, so the argument from > "don't avoid directories unless you are certain" would militate in favor of > changing the behavior. I've noticed things getting deleted before, other times I've used the command "rm -rf". I'm glad I'm not the only one seeing this behaviour. 8-) 8-) 8-) 8-). > (Not that I'm advocating such a change. The FreeBSD behavior seems > consistent & sensible to me; the Linux behavior [as described on this list] > does not; other Unices vary, and clearly there is little consistency. None > of which matters if people just avoid trailing slashes. Since trailing > slashes are rarely seen unless they are deliberately being used to mean > something special, I prefer FreeBSD's semantics, which do something useful > with that information over other semantics which always discard that > information.) Trailing slashes "magically" appear in shells that do completion, and in badly fit together scripts, where it's easier to put a trailing slash on a variable content for a directory, then to ensure that there is a "/" prefix on non-empty appended path components (if any -- and the optional nature of them makes it harder). It's validly arguable that an "rm -rf foo/" should remove only "foo", if it is a symlink to a directory, rather than the directory contents. If you were to do an "rm -rf fee/", and "fee/" was a directory containing a symplink "foo" to another directory, you would expect the link, not the target, to be deleted. However... I think that the trailing slash semantics are also arguable, and, being that they are consistant between commands, more correct than anything that results in an inconsistancy. I think the most telling thing is "what do we expect when": cd /tmp mkdir -p foo/fee cp /etc/ttys foo/fee/ttys ln -s foo xyz rm -rf xyz/fee ...we expect it to follow the link "xyz" because of the trailing "/" in the "xyz/" path component. -- Terry To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3CB4D51F.A4473F9C>