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

Re: zgetcwd patch?

On Aug 15,  7:15am, John M. Harres wrote:
} Subject: zgetcwd patch?
} I never heard a response to the patch I sent to compat.c.

Just so you know someone's paying attention ...

} Does it appear correct?

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?

} I'm also curious under what circumstances these two operations differ (aside
} from the obvious chdir side effect):
} 1. opendir( ".." );
} 2. chdir( ".." );
} 	opendir( "." );

It could have something to do with crossing NFS mount points.  I can't
figure out precisely what, though, as I don't have any NFS-mounted
filesystems to try it on.

More likely, though, it's just expediency.  The chdir("..") is done so
that lstat() can be called directly on de->d_name.  There's probably no
reason that
	dir = opendir(".");
could not be replaced by
unless maybe there's some implementation of the directory library out
there that doesn't have rewinddir().

Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

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