none.

John P. Nelson jpn at genrad.com
Wed Nov 23 01:05:42 AEST 1988


>>Big mistake.  You've just probably destroyed all the user directories on
>>the machine, since ".*" matches "..", too.  Nice going.
>
>Maybe on some UNIX systems, but the man page for rm on System V states:
>
>	".... It is forbidden to remove the file .. merely to avoid
>	the antisocial consequences of inadvertently doing something like:
>
>		rm -r .*						"

This is true on Berkeley systems as well.  HOWEVER, it is easy to fool
rm, because the test only works when ".." is at the BEGINNING of the
filename.  I was quite surprised the first time I discovered this:  I
had written a "safe" rm which tucked files away in my "~/.backup" directory,
the idea was to clean out the ~/.backup directory when I logged out.

when I put the line "rm -rf ~/.backup/* ~/.backup/.*" into my .logout
file, I got a nasty surprise!  When I logged in again, my entire account
had been deleted!  ~/.backup/.* had expanded to ~/.backup/.., and rm
quite silently recursively removed my home directory!
     john nelson

UUCP:	{decvax,mit-eddie}!genrad!teddy!jpn
smail:	jpn at teddy.genrad.com



More information about the Comp.unix.wizards mailing list