Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/5/84; site rlgvax.UUCP Path: utzoo!linus!decvax!wivax!cadmus!harvard!seismo!rlgvax!guy From: guy@rlgvax.UUCP Newsgroups: net.unix-wizards Subject: Re: .. in the root of a filesystem Message-ID: <94@rlgvax.UUCP> Date: Tue, 11-Sep-84 02:13:56 EDT Article-I.D.: rlgvax.94 Posted: Tue Sep 11 02:13:56 1984 Date-Received: Sun, 16-Sep-84 11:13:38 EDT References: <238@callan.UUCP> Organization: CCI Office Systems Group, Reston, VA Lines: 27 > In namei, when checking to see if it should scan > the mount table for a link backwards across > a file system, it does the following... > Note that it only looks at the second character in the file name. > This leads to weird results if you just happen to have a directory > in the root of a mounted file system with a . in the second position, > and you also just happen to have a directory of the same name in > the directory you are mounted on. > > Does anybody depend on it only looking at the second character? > Any idea why they did it this way? Note that the inumber of the directory entry whose second character is '.' must be ROOTINO, which is the inumber of a root directory (2 on V7 and all post-V7 systems) for "namei" to decide that it should use the entry in the mounted-on directory. In a "normal" file system, this shouldn't happen, as the only directory entries that refer to the root inode should be the "." entry in the root directory, the ".." entry in that directory, and the ".." entries in directories immediately under the root; the test of dp->d_ino eliminates the third category, and a test of the second character of the directory entry suffices to eliminate the first. I presume it was done because it works unless something is wierd and is a cheap quick test, as opposed to a full-blown "strcmp" against "..". Guy Harris {seismo,ihnp4,allegra}!rlgvax!guy