Windows file locking with bzr 2.2.3

John Arbash Meinel john at arbash-meinel.com
Thu Feb 24 21:47:52 UTC 2011


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


...
> Basically, 'file-ids-from' is designed so you can pass a *different*
> tree as the source for the path-id mappings. That tree is read-locked,
> then the current tree to add stuff in is opened write-locked. As locks
> on unix don't do anything half the time using the same tree twice
> works there, but windows is stricter.

Just to clarify a bit. fcntl locking on Unix (just Linux?) allows a
single process to lock a file with both a shared lock and an exclusive
lock. Any other process will be blocked once an exclusive lock is taken.

On Windows, taking an exclusive lock blocks all other requests, even
from the same process. IMO Windows makes more sense here, for whatever
the purpose of locking the file, most logic will assume they got what
they asked for. (Thread1 thinks it has an exclusive lock, so does
thread2, but they can both mutate the state on Linux.)

Anyway, Martin's suggestion is accurate. There isn't a reason to pass
'.' as the location to get file-ids from, only pass it if you have
another tree you are comparing against.

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

iEYEARECAAYFAk1m0ggACgkQJdeBCYSNAAMomgCcDtfhH38PiVx4+ARtlpbB0S4b
ko8AnRL4aXha9v8wuRBT+UA21IjbuB6u
=hbRP
-----END PGP SIGNATURE-----



More information about the bazaar mailing list