Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watmath!clyde!cbosgd!ihnp4!alberta!sask!reid From: reid@sask.UUCP Newsgroups: comp.os.minix Subject: Re: Request for help with rmdir bug Message-ID: <763@sask.UUCP> Date: Mon, 8-Jun-87 02:29:15 EDT Article-I.D.: sask.763 Posted: Mon Jun 8 02:29:15 1987 Date-Received: Wed, 10-Jun-87 07:16:27 EDT References: <1195@botter.cs.vu.nl> Reply-To: reid@sask.UUCP (Irving Reid) Distribution: world Organization: The Church of the Least Fixed Point Lines: 38 In article <1195@botter.cs.vu.nl> ast@cs.vu.nl (Andy Tanenbaum) writes: > ... >rmdir fails. I checked the code of rmdir. What happens is that rmdir >first unlinks . and .. from foo, then it tries to access foo/../foo to >unlink the directory, but that path is no longer valid because .. is now >gone. I tried the same test on our VAX with 4.1 BSD and it failed >there too. > >The question is: does anyone have an idea how to make rmdir work without >modifying the kernel. Unlinking the directory before removing . and .. >does not sound like a good idea. > >Andy Tanenbaum (ast@cs.vu.nl) I have no idea how any Unices do it, but how about: /* rmdir.pseudo-c: */ rmdir(directory) { chdir("directory/.."); dname <- name of directory with any path stripped off; unlink(dname/..); unlink(dname/.); unlink(dname); } This would fail at the root directory, because /. and /.. are both links to / (at least on the Unices I've used), but should work everywhere else. (by the way, Ultrix 1.2 (almost 4.2BSD) handles the bad rmdir correctly) -- - !Baboo - (reid@sask.uucp or {alberta, ihnp4, utcsri}!sask!reid) Rabbi, is there a proper blessing for the Tsar? Certainly, my son. May God bless and keep the Tsar... Far away from us.