Date: Sun, 29 Oct 2006 20:34:21 -0500 From: Mike Meyer <mwm-keyword-freebsdhackers2.e313df@mired.org> To: "Steven Hartland" <killing@multiplay.co.uk> Cc: Joerg Pernfuss <elessar@bsdforen.de>, freebsd-hackers@freebsd.org Subject: Re: [patch] rm can have undesired side-effects Message-ID: <17733.22173.12972.677850@bhuda.mired.org> In-Reply-To: <00f201c6fbb6$0c6bd150$b3db87d4@multiplay.co.uk> References: <20061029222847.GA68272@marvin.astase.com> <20061030003628.42bc5f8d@loki.starkstrom.lan> <00f201c6fbb6$0c6bd150$b3db87d4@multiplay.co.uk>
next in thread | previous in thread | raw e-mail | index | archive | help
In <00f201c6fbb6$0c6bd150$b3db87d4@multiplay.co.uk>, Steven Hartland <killing@multiplay.co.uk> typed: > > ----- Original Message ----- > From: "Joerg Pernfuss" <elessar@bsdforen.de> > >> I guess that it can be fixed (in case it is not desired) by: > >> - Ignoring the -P option when the link count is greater then one, or > > Silently ignoring user specified options is seldom a good way to go. > > The user explicitly stated he wants to wipe the file contents. > That maybe the case but does rm -f <file> remove all copies? > Nope so its behaviour is safe even with multiple hardlinks. Of course it doesn't remove all copies - because there *aren't* multiple copies. There is only *one* copy, with multiple hardlinks. You told it to remove one hardlink, and it did that, without caring if that's the last link or not, and erroring out because you could lose data if it's the last link. > From the description I've seen thats not the case for -P > here and as such I dont think its quite a simple as that. I think it is. There's a flag that basically says "make sure no one can read this data ever again". It does that. That said data is still available via some other link is immaterial. > My personal preference would be for it to warn or perhaps > error if the link count is not zero. Possibly use -f to > override this but even that I'd say is dangerous. My personal preference is that the system do what I tell it to. If I wanted a system that second guessed me and didn't do things that I told it to because it thought it knew better than I did what I wanted, I wouldn't be using Unix. Adding code so that this is mentioned if you asked to be coddled with -i or -I is probably worthwhile, at least if you can make it not ask if you're actually removing all the links if you do -RP. <mike -- Mike Meyer <mwm@mired.org> http://www.mired.org/consulting.html Independent Network/Unix/Perforce consultant, email for more information.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?17733.22173.12972.677850>