Detecting the same directory is usually done by comparing
(st_dev,st_ino). It is after all the only way to detect hard links.
find(1) does this to avoid following directory cycles
> As for the symlinks - you are missing another problem: .. handling. Shell
> somewhat hides it, but it makes things even uglier when you get
> $ ls ..
> bin dev home lost+found mnt proc sbin usr
> boot etc lib misc opt root tmp var
> $ cd ..
> $ ls bin
> ls: bin: No such file or directory
>
> IMO security-concerned stuff should treat mountpoints the same way it
> treats symlinks. Notice that bindings _are_ mountpoints in all respects
> and if you bind the root of filesystem tree you can't distinguish that
> from the case when you simply mounted that fs twice - it will give you
> exactly the same state. And treatment of mountpoints might be nicer, to
> put it mildly - rm -rf crossing the mountpoints hardly made anyone
> happy ;-/
It's ugly, but maybe they could appear as symlinks "mntpnt ->
mntpnt/:vfsmount_info"? .. works as you want and they're not followed
by security-conscious stuff.
-- Jamie
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/