From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14402 invoked from network); 18 Aug 1997 19:56:00 -0000 Received: from euclid.skiles.gatech.edu (list@130.207.146.50) by ns1.primenet.com.au with SMTP; 18 Aug 1997 19:56:00 -0000 Received: (from list@localhost) by euclid.skiles.gatech.edu (8.8.5/8.8.5) id PAA09012; Mon, 18 Aug 1997 15:50:17 -0400 (EDT) Resent-Date: Mon, 18 Aug 1997 15:50:17 -0400 (EDT) Message-ID: <19970818124801.25766@molehill.org> Date: Mon, 18 Aug 1997 12:48:01 -0700 From: Todd Larason To: Bart Schaefer Cc: "John M. Harres" , zsh-workers@math.gatech.edu Subject: Re: zgetcwd patch? References: <199708151315.HAA24323@ghidora.uwyo.edu> <970817220553.ZM23929@candle.brasslantern.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.76e In-Reply-To: <970817220553.ZM23929@candle.brasslantern.com>; from Bart Schaefer on Sun, Aug 17, 1997 at 10:05:53PM -0700 Resent-Message-ID: <"30PCq2.0.iC2.uTA-p"@euclid> Resent-From: zsh-workers@math.gatech.edu X-Mailing-List: archive/latest/3448 X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu On Sun, Aug 17, 1997 at 10:05:53PM -0700, Bart Schaefer wrote: > It doesn't look wrong to me, but I'm not sure why it wasn't used in the > first place, so I can't say for certain. My guess is that there was an > assumption of at most one mount of the same device in any given directory, > so the second loop is (before your patch) finding any mount point matching > the device and assuming that must be the one. > > Why is it, again, that de->d_ino != sbuf.st_ino for the dir in question? My understanding was that the first loop would find the parent if it was in the same filesystem as the child; the second would find the place the child was mounted, in the only other case. The problem is that it was assumed that a filesystem can only be mounted one place, and that the device number identifies filesystems. In this situation, there's /home on filesystem one, /home/a and /home/b are both automounted directories from filesystem 2. for a and b, de->d_ino is the inode of the mountpoint directory in /home, in filesystem 1; sbuf.st_ino is the inode of the mounted directory, in filesystem 2. > } I'm also curious under what circumstances these two operations differ (aside > } from the obvious chdir side effect): > } > } 1. opendir( ".." ); > } > } 2. chdir( ".." ); > } opendir( "." ); These do the same thing; the only important difference is that the second lstat()s and compares that info instead of the directory info. These could be combined into one loop, but you don't really want to stat unless you have to. >From zsh-workers-request@math.gatech.edu Mon Aug 18 20:21:04 1997 Return-Path: Delivered-To: mason@primenet.com.au Received: (qmail 14552 invoked from network); 18 Aug 1997 20:21:02 -0000 Received: from euclid.skiles.gatech.edu (HELO euclid.math.gatech.edu) (root@130.207.146.50) by coral.primenet.com.au with SMTP; 18 Aug 1997 20:21:02 -0000 Received: (from list@localhost) by euclid.skiles.gatech.edu (8.8.5/8.8.5) id PAA09012; Mon, 18 Aug 1997 15:50:17 -0400 (EDT) Resent-Date: Mon, 18 Aug 1997 15:50:17 -0400 (EDT) Message-ID: <19970818124801.25766@molehill.org> Date: Mon, 18 Aug 1997 12:48:01 -0700 From: Todd Larason To: Bart Schaefer Cc: "John M. Harres" , zsh-workers@math.gatech.edu Subject: Re: zgetcwd patch? References: <199708151315.HAA24323@ghidora.uwyo.edu> <970817220553.ZM23929@candle.brasslantern.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.76e In-Reply-To: <970817220553.ZM23929@candle.brasslantern.com>; from Bart Schaefer on Sun, Aug 17, 1997 at 10:05:53PM -0700 Resent-Message-ID: <"30PCq2.0.iC2.uTA-p"@euclid> Resent-From: zsh-workers@math.gatech.edu X-Mailing-List: archive/latest/3448 X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu On Sun, Aug 17, 1997 at 10:05:53PM -0700, Bart Schaefer wrote: > It doesn't look wrong to me, but I'm not sure why it wasn't used in the > first place, so I can't say for certain. My guess is that there was an > assumption of at most one mount of the same device in any given directory, > so the second loop is (before your patch) finding any mount point matching > the device and assuming that must be the one. > > Why is it, again, that de->d_ino != sbuf.st_ino for the dir in question? My understanding was that the first loop would find the parent if it was in the same filesystem as the child; the second would find the place the child was mounted, in the only other case. The problem is that it was assumed that a filesystem can only be mounted one place, and that the device number identifies filesystems. In this situation, there's /home on filesystem one, /home/a and /home/b are both automounted directories from filesystem 2. for a and b, de->d_ino is the inode of the mountpoint directory in /home, in filesystem 1; sbuf.st_ino is the inode of the mounted directory, in filesystem 2. > } I'm also curious under what circumstances these two operations differ (aside > } from the obvious chdir side effect): > } > } 1. opendir( ".." ); > } > } 2. chdir( ".." ); > } opendir( "." ); These do the same thing; the only important difference is that the second lstat()s and compares that info instead of the directory info. These could be combined into one loop, but you don't really want to stat unless you have to. >From zsh-workers-request@math.gatech.edu Tue Aug 19 00:52:25 1997 Return-Path: Delivered-To: mason@primenet.com.au Received: (qmail 15686 invoked from network); 19 Aug 1997 00:52:23 -0000 Received: from euclid.skiles.gatech.edu (HELO math.gatech.edu) (root@130.207.146.50) by ns1.primenet.com.au with SMTP; 19 Aug 1997 00:52:23 -0000 Received: (from list@localhost) by euclid.skiles.gatech.edu (8.8.5/8.8.5) id PAA09012; Mon, 18 Aug 1997 15:50:17 -0400 (EDT) Resent-Date: Mon, 18 Aug 1997 15:50:17 -0400 (EDT) Message-ID: <19970818124801.25766@molehill.org> Date: Mon, 18 Aug 1997 12:48:01 -0700 From: Todd Larason To: Bart Schaefer Cc: "John M. Harres" , zsh-workers@math.gatech.edu Subject: Re: zgetcwd patch? References: <199708151315.HAA24323@ghidora.uwyo.edu> <970817220553.ZM23929@candle.brasslantern.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.76e In-Reply-To: <970817220553.ZM23929@candle.brasslantern.com>; from Bart Schaefer on Sun, Aug 17, 1997 at 10:05:53PM -0700 Resent-Message-ID: <"30PCq2.0.iC2.uTA-p"@euclid> Resent-From: zsh-workers@math.gatech.edu X-Mailing-List: archive/latest/3448 X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu On Sun, Aug 17, 1997 at 10:05:53PM -0700, Bart Schaefer wrote: > It doesn't look wrong to me, but I'm not sure why it wasn't used in the > first place, so I can't say for certain. My guess is that there was an > assumption of at most one mount of the same device in any given directory, > so the second loop is (before your patch) finding any mount point matching > the device and assuming that must be the one. > > Why is it, again, that de->d_ino != sbuf.st_ino for the dir in question? My understanding was that the first loop would find the parent if it was in the same filesystem as the child; the second would find the place the child was mounted, in the only other case. The problem is that it was assumed that a filesystem can only be mounted one place, and that the device number identifies filesystems. In this situation, there's /home on filesystem one, /home/a and /home/b are both automounted directories from filesystem 2. for a and b, de->d_ino is the inode of the mountpoint directory in /home, in filesystem 1; sbuf.st_ino is the inode of the mounted directory, in filesystem 2. > } I'm also curious under what circumstances these two operations differ (aside > } from the obvious chdir side effect): > } > } 1. opendir( ".." ); > } > } 2. chdir( ".." ); > } opendir( "." ); These do the same thing; the only important difference is that the second lstat()s and compares that info instead of the directory info. These could be combined into one loop, but you don't really want to stat unless you have to.