fixing rm * (was: Worm/Passwords)

Paul Traina pst at canary.cdi.com
Thu Nov 17 04:30:11 AEST 1988


>From article <1232 at atari.UUCP>, by achar at atari.UUCP (Alan Char):
< Actually, you can change the shell.  (Nowadays, that's more like three to
< five things.)  For example, I would REALLY appreciate in csh a variable
< 
< 	set expandcheck=5
< 
< So that if some shell expansion expanded to more than 5 things, it would
< prompt for confirmation:
< 
< 	% rm * .o
< 	*: matches 400 files, are you sure?
< 
< Comments on this idea?  --Alan

I'll assume (from the gist of the protection) that this is to stop
stupidity, rather than a deliberate attack.  After all, a worm would
either know what to do at this point, or more likely, have used unlink(2).

My question is,  if we have the shell fix it,  how can we get the shell
to understand flags passed to the executable?  To give an example, if I
do 'rm * .o' I probably wouldn't mind seeing the match message come up.

However, 'rm -f * .o' means do it, yes I mean it, don't ask stupid questions.
I would use it in a shell script no doubt.  Now of course, it's pretty unlikely
that's what I meant.  Perhaps better consistency checking in rm itself would
be the answer.

For instance,  have rm (if -f is not used) check each path parameter passed to
it.  If one doesn't match at existing file at all, ask that the command be
confirmed.  Well, like any solution that's been discussed so far, this has
problems too.  I guess the best solution would be a modification of the human
involved so s/he always types what s/he means to type.  hmmm.

Comments on these ideas?

------
Paul Traina				To believe that what is true for
{uunet|pyramid}!comdesign!pst		you in your private heart is true
pst at cdi.com				for all men, that is genius.



More information about the Comp.unix.wizards mailing list