[patch] rm can have undesired side-effects
mwm-keyword-freebsdhackers2.e313df at mired.org
Tue Oct 31 00:38:22 UTC 2006
In <200610301613.59298.fcash at ocis.net>, Freddie Cash <fcash at ocis.net> typed:
> On Monday 30 October 2006 01:17 pm, Mike Meyer wrote:
> > In <45466902.5090603 at FreeBSD.org>, Doug Barton <dougb at FreeBSD.org>
> > > Simon L. Nielsen wrote:
> > > > Personally I think rm should do what you ask it to do - if you ask
> > > > it to overwrite a file which has multiple links, well... though
> > > > luck.
> > >
> > > It's all well and good to say, "tough luck," but I don't think that's
> > > what our users expect.
> > I'm a user. It's what I expect. If I wanted an OS that protected me
> > from myself, I wouldn't be running Unix. Please give me the rope I
> > need to get the job done. If that happens to be enough that I can hang
> > myself, and I sometimes do - well, I got what I asked for. When I want
> > to be coddled, I'll run a different OS.
> Isn't that what the -f option is for in every command?
So how does the '-f' option to cc give me more rope?
> By default, be conservative in what you do (error out with nice messages
> when in doubt).
So why doesn't "rm foo" not error out with a nice message if it would
be removeing the last link to foo? After all, that's the conservative
thing to do, and if the user really wants to remove the last link:
> If the user knows what they are doing then let them specify -f.
Now you've decided that you know better what the user wants than they
do. That's not what I expect from a Unix system. The claim was that
that's not "what our users expect". I was pointing out that there's at
least one user who expects - indeed, prefers - that the system do what
they tell it to, without trying to protect them from themselves.
Mike Meyer <mwm at mired.org> http://www.mired.org/consulting.html
Independent Network/Unix/Perforce consultant, email for more information.
More information about the freebsd-hackers