[merge][#297831] use open/fchdir to save and restore cwd

John Arbash Meinel john at arbash-meinel.com
Fri Nov 21 18:08:06 GMT 2008


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Martin Pool wrote:

> Because of a limited number of file handles, or ...?

because holding a file handle implicitly locks all of the containing
directories.

So if you open "C:\foo\bar\baz.txt" all of "foo", "bar", and "baz.txt"
are locked and cannot be renamed, etc.

And if we get a failure and fail to close the file handle, then we've
leaked the file handle and path locks.

It will all be cleared up when the process exits.

> 
> I would not be surprised if fchdir can't be done locally and needs to
> be emulated in some way in cygwin.  Can we use the _walkdirs_win32
> from inside cygwin?
> 
> Anyhow, I've sent it to pqm.
> 

Probably some way we could get there, but it doesn't play nicely with
how cygwin manages the Executable bit, etc.

Certainly it would be nice, doing "bzr status" under cygwin takes 2+s on
a bzr.dev tree, while it takes only 0.5s under Win32 (and 0.8s if I
disable the _walkdirs_win32 extension.)

Obviously there is a lot of overhead in using cygwin, which is why *I*
stopped a long time ago.

John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkkm+QYACgkQJdeBCYSNAAP+qgCeJdyEMqtSy8N5wvGhjLb8D510
TUcAn2aR6g928X7KTOQOy1ecufqI9ubM
=3eph
-----END PGP SIGNATURE-----



More information about the bazaar mailing list