From owner-freebsd-hackers@FreeBSD.ORG Mon Oct 30 01:33:55 2006 Return-Path: X-Original-To: freebsd-hackers@freebsd.org Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 298C516A403 for ; Mon, 30 Oct 2006 01:33:55 +0000 (UTC) (envelope-from mwm-keyword-freebsdhackers2.e313df@mired.org) Received: from mired.org (vpn.mired.org [66.92.153.74]) by mx1.FreeBSD.org (Postfix) with SMTP id E98DC43D7E for ; Mon, 30 Oct 2006 01:33:41 +0000 (GMT) (envelope-from mwm-keyword-freebsdhackers2.e313df@mired.org) Received: (qmail 39878 invoked by uid 1001); 30 Oct 2006 01:34:21 -0000 Received: by bhuda.mired.org (tmda-sendmail, from uid 1001); Sun, 29 Oct 2006 20:34:21 -0500 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <17733.22173.12972.677850@bhuda.mired.org> Date: Sun, 29 Oct 2006 20:34:21 -0500 To: "Steven Hartland" 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> X-Mailer: VM 7.17 under 21.4 (patch 19) "Constant Variable" XEmacs Lucid X-Primary-Address: mwm@mired.org X-face: "5Mnwy%?j>IIV\)A=):rjWL~NB2aH[}Yq8Z=u~vJ`"(,&SiLvbbz2W`; h9L,Yg`+vb1>RG% *h+%X^n0EZd>TM8_IB;a8F?(Fb"lw'IgCoyM.[Lg#r\ X-Delivery-Agent: TMDA/1.1.5 (Fettercairn) From: Mike Meyer Cc: Joerg Pernfuss , freebsd-hackers@freebsd.org Subject: Re: [patch] rm can have undesired side-effects X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Oct 2006 01:33:55 -0000 In <00f201c6fbb6$0c6bd150$b3db87d4@multiplay.co.uk>, Steven Hartland typed: > > ----- Original Message ----- > From: "Joerg Pernfuss" > >> 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 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. http://www.mired.org/consulting.html Independent Network/Unix/Perforce consultant, email for more information.