How do I unlink directories created with ln -f?

Mark Andrews marka at dmssyd.syd.dms.CSIRO.AU
Mon Jul 2 14:15:34 AEST 1990


In article <3575 at auspex.auspex.com> guy at auspex.auspex.com (Guy Harris) writes:
|>Suppose it's a bug in unlink.

|It is.  SunOS, for some unknown reason, disallows (at the system call
|level, not at the file system level!) *all* attempts to unlink
|directories, even by the super-user.

|>It seems really as if the only way would be a `clri' on the
|>inode of "dir1" and "dir2",

|They share the same inode; one "clri" is sufficient.

|>followed by a `fsck', which will remove the directories.

|...and shove everything that was in them into "lost+found", with cryptic
|names.

|Unless the directory in question was empty, I'd first make another
|directory at the same level as the link you wanted to keep, move
|everything (don't forget files, other than the obvious "." and "..",
|with names beginning with "."!) into the new directory, then do the
|unmount/clri/fsck.  (Don't forget the unmount.)

Fsck can actually pick this condition up (well it did it once). If you
move all links to the directory to a new directory, umount and run
fsck it should pick up the problem.

"IS AN EXTRANEOUS HARD LINK TO DIRECTORY" from strings of fsck.

Mark.



More information about the Comp.unix.wizards mailing list