Protection from "rm *"

Jonathan I. Kamens jik at athena.mit.edu
Fri Oct 19 17:41:49 AEST 1990


In article <1990Oct18.152958.15635 at eci386.uucp>, jmm at eci386.uucp (John Macdonald) writes:
|> If this is a frequently occurring activity, then there is a simple way of
|> getting choice (a) to work correctly.  Make a directory "old" in each bin
|> directory.  To destructively update foo, "mv foo old/rm$$", and then copy
|> in the new version.  Have a cron job that runs nightly that does
|> "find /bin/old /usr/bin/old <any others> -type f -print | xargs rm -f".
|> It will keep trying until it can actually do the job.  In times of heavy
|> program upgrades, the cron job could be tried hourly if the old versions
|> are cluttering up the disk.  Alternately, the script that does moves old
|> stuff to the old directory could get fancy - remove if possible before
|> moving to old, and try to clean out the old directory too in case something
|> is now removable.

  So, if we don't want "old" directories all over the place, then every
partition on the system has to know have an old directory somewhere on it (so
the "mv" can occur without copying across partitions), and every makefile that
does installations has to know what directory it's supposed to move the old
binary into when installing.

  The makefiles can be simpler if every directory has an old subdirectory, but
that means that there are "old" directories scattered all over the system
cluttering it up.

  Alternatively, we could just fix the System V kernel so it does the right
thing and allows you to unlink the executable.  Why are you fighting so hard
to figure out obviously suboptimal solutions, when the correct solution is
already clear (and is trivial to implement, and in fact is already implemented
in SVR4 and in most (if not all) BSD-based systems)?

-- 
Jonathan Kamens			              USnail:
MIT Project Athena				11 Ashford Terrace
jik at Athena.MIT.EDU				Allston, MA  02134
Office: 617-253-8085			      Home: 617-782-0710



More information about the Comp.unix.misc mailing list