Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: zgetcwd patch?



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@xxxxxxxxxxxxxxx Mon Aug 18 20:21:04 1997
Return-Path: <zsh-workers-request@xxxxxxxxxxxxxxx>
Delivered-To: mason@xxxxxxxxxxxxxxx
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@xxxxxxxxxxxxxx)
  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@xxxxxxxxxxxx>
Date: Mon, 18 Aug 1997 12:48:01 -0700
From: Todd Larason <jtl@xxxxxxxxxxxx>
To: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
Cc: "John M. Harres" <harres@xxxxxxxxxxxxxxxx>, zsh-workers@xxxxxxxxxxxxxxx
Subject: Re: zgetcwd patch?
References: <199708151315.HAA24323@xxxxxxxxxxxxxxxx> <970817220553.ZM23929@xxxxxxxxxxxxxxxxxxxxxxx>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
X-Mailer: Mutt 0.76e
In-Reply-To: <970817220553.ZM23929@xxxxxxxxxxxxxxxxxxxxxxx>; 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@xxxxxxxxxxxxxxx
X-Mailing-List: <zsh-workers@xxxxxxxxxxxxxxx> archive/latest/3448
X-Loop: zsh-workers@xxxxxxxxxxxxxxx
Precedence: list
Resent-Sender: zsh-workers-request@xxxxxxxxxxxxxxx

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@xxxxxxxxxxxxxxx Tue Aug 19 00:52:25 1997
Return-Path: <zsh-workers-request@xxxxxxxxxxxxxxx>
Delivered-To: mason@xxxxxxxxxxxxxxx
Received: (qmail 15686 invoked from network); 19 Aug 1997 00:52:23 -0000
Received: from euclid.skiles.gatech.edu (HELO math.gatech.edu) (root@xxxxxxxxxxxxxx)
  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@xxxxxxxxxxxx>
Date: Mon, 18 Aug 1997 12:48:01 -0700
From: Todd Larason <jtl@xxxxxxxxxxxx>
To: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
Cc: "John M. Harres" <harres@xxxxxxxxxxxxxxxx>, zsh-workers@xxxxxxxxxxxxxxx
Subject: Re: zgetcwd patch?
References: <199708151315.HAA24323@xxxxxxxxxxxxxxxx> <970817220553.ZM23929@xxxxxxxxxxxxxxxxxxxxxxx>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
X-Mailer: Mutt 0.76e
In-Reply-To: <970817220553.ZM23929@xxxxxxxxxxxxxxxxxxxxxxx>; 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@xxxxxxxxxxxxxxx
X-Mailing-List: <zsh-workers@xxxxxxxxxxxxxxx> archive/latest/3448
X-Loop: zsh-workers@xxxxxxxxxxxxxxx
Precedence: list
Resent-Sender: zsh-workers-request@xxxxxxxxxxxxxxx

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.



Messages sorted by: Reverse Date, Date, Thread, Author