A Generation Lost in the Bazaar - Poul-Henning Kamp article
Ben Walton
bdwalton-Re5JQEeQqe8AvxtiuMwx3w at public.gmane.org
Fri Aug 24 01:42:03 UTC 2012
> I think it's a good thing that rm doesn't try to guess what you meant.
> I like that unix systems do what I say, not what it thinks I meant.
> If I don't say what I mean, that's my problem.
>
> And changing rm is NOT safe. Some people are used to the fact rm only
> removes files so doing rm * will remove files, but not directories.
> If you change it you break stuff that currently has a known expected
> behaviour.
I agree here.
Consider:
rm somedir
rm somedir/
rm somelink_to_dir
rm somelink_to_dir/
(In each case, consider that the argument to rm has the same name.)
In all cases, the target directory is empty. Case 1 and 2 are the
treated same and currently result in the error condition. Case 3
currently sees rm remove the symlink. Case 4 currently complains
about removing a directory because it dereferences the symlink.
(*Lots of handwaving about the ficticious situation here*)
Now, consider a script where case 2 is changed to case 4 by some agent
you're not aware of...the semantics of the operation have now changed.
Should it still remove the directory if empty? If nothing else,
this opens up an opportunity for an attacker to take advantage of a
script that relies on the current behaviour.
Also, if case 1 is changed to case 3 by an agent, the semantics change
again. The directory would remain but the symlink would be removed.
Is that what you wanted?
This is the type of behaviour change that has the potential to wreak
havoc everywhere. Had they decided to make (empty) directory removal
standard in 1974, maybe it would have been ok...now, I don't think it
would be a good change. I'm not convinced it would have been a good
choice in 1974 either.
Thanks
-Ben
--
---------------------------------------------------------------------------------------------------------------------------
Ben Walton <bdwalton-Re5JQEeQqe8AvxtiuMwx3w at public.gmane.org>
Take the risk of thinking for yourself. Much more happiness,
truth, beauty and wisdom will come to you that way.
-Christopher Hitchens
---------------------------------------------------------------------------------------------------------------------------
--
The Toronto Linux Users Group. Meetings: http://gtalug.org/
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://gtalug.org/wiki/Mailing_lists
More information about the Legacy
mailing list