Hard links to directories: why not?

Alan J Rosenthal flaps at dgp.toronto.edu
Thu Jul 26 01:56:28 AEST 1990


jfh at rpp386.cactus.org (John F. Haugh II) writes:
>The conversion of /mnt/a and /mnt/b/c/d to absolute pathnames need only
>recognize that /mnt/a and /mnt/b are identical to know that a loop is being
>created.
...
>It is quite possible to detect the creation of loops in the filesystem...

I certainly wasn't claiming it wasn't computable to determine whether or not a
new link caused a loop in the filesystem.

However, the original article's method was faulty as I illustrated.  "/mnt/a"
is certainly an absolute pathname, even if due to abnormalities in the
filesystem it is not canonical in some sense.  Once absolute pathnames were
obtained, it advised using strncmp(), which certainly doesn't think that /mnt/a
is an initial string of /mnt/b/c/d.

Do you have a method for detecting loops which doesn't involve searching the
whole i-list or the whole file graph?



More information about the Comp.unix.wizards mailing list