Subject: Re: How .. is resolved at mountpoints
To: None <tech-kern@netbsd.org>
From: Greg A. Woods <woods@most.weird.com>
List: tech-kern
Date: 03/16/2000 01:41:31
[ On Wednesday, March 15, 2000 at 21:35:56 (-0500), John Kohl wrote: ]
> Subject: Re: How .. is resolved at mountpoints
>
> >>>>> "JF" == Jonathan Fuerth <fuerth@jake.capybara.org> writes:
> 
> JF> How does the kernel's pathname->(device, inode) algorithm work when a 
> JF> pathname of ".." is given to it when the current directory is the top level
> JF> of a mounted filesystem (other than the root filesystem, of course).
> 
> See /usr/src/sys/kern/vfs_lookup.c:namei().
> In there you'll find this notation:
> 
> 	/*
> 	 * Handle "..": two special cases.
> 	 * 1. If at root directory (e.g. after chroot)
> 	 *    or at absolute root directory
> 	 *    then ignore it so can't get out.

Hmmm...  why is there any thing special done when at the absolute root
directory?  Isn't ".." still guaranteed to be just a hard link to "." in
the root directory (unless of course you are in fact chroot'ed).

Looking very briefly at the code I see that the elimination of this test
wouldn't likely make much difference of course, and keeping it will
obviate the need for worrying about the correctness of the ".."
directory entry in the absolute root....

-- 
							Greg A. Woods

+1 416 218-0098      VE3TCP      <gwoods@acm.org>      <robohack!woods>
Planix, Inc. <woods@planix.com>; Secrets of the Weird <woods@weird.com>