VERY SERIOUS rmdir bug

john at basser.UUCP john at basser.UUCP
Fri Jul 18 04:41:13 AEST 1986


John Tupper pointed out an rm bug (that it didn't check properly
for pathnames ending in .. on recursive removes).  That got one of
our users here to experimenting, and he found that he could remove ..
from directories.  The amount of braindamage this sort of thing can
cause is large.  I believe that the bug will be likely to be found
on any machine that doesn't do rmdir by system call, although I haven't
checked sysV sources, not having any handy.

To demonstrate the bug, do this:

$ mkdir foo foo/bar
$ rmdir foo/bar/../bar
(rmdir will cough along the lines of "foo/bar/../bar not removed")
$ od -c foo/bar
(note the lack of a .. in bar.  get very sad.)

We have fixed rmdir, but I would like to wait a couple of days to
see if I can think of any more problems (or any bugs in the fix,
which wasn't simple) before posting a diff.

John Mackin, Basser Department of Computer Science,
	     University of Sydney, Sydney, Australia

{seismo,hplabs,mcvax,ukc,nttlab}!munnari!basser.oz!john
john at basser.oz.au (john%basser.oz at SEISMO.CSS.GOV)



More information about the Comp.unix.wizards mailing list