Windows file locking with bzr 2.2.3
W. Trevor King
wking at drexel.edu
Thu Feb 24 20:09:05 UTC 2011
Bazaar folks,
We've been having some trouble with Bazaar v2.2.3 WriteLocks in Bugs
Everywhere on Windows [1], and have isolated the problem in the
attached script, basically wrapping:
cmd = bzrlib.builtins.cmd_add()
cmd.outf = sys.stdout
cmd.run([new_file], file_ids_from='.')
On Linux I get [2]:
$ python bzr-be-test.py
working in /tmp/tmp-bbtMJijPe
initialize Bazaar repo
Created a standalone tree (format: 2a)
create a dummy file a_file
add the file via Python
adding a_file
success
cleanup test directory
While on Windows Michael Chaffin gets [3]:
C:\Temp>bzr-be-test.py
working in c:\windows\temp\tmp-bbtuqtiq1
initialize Bazaar repo
Created a standalone tree (format: 2a)
create a dummy file a_file
add the file via Python
cleanup test directory
Traceback (most recent call last):
File "C:\Temp\bzr-be-test.py", line 26, in <module>
cmd.run([new_file], file_ids_from='.')
File "C:\PROGRA~1\Python26\lib\site-packages\bzrlib\commands.py", line
705, in run
return self._operation.run_simple(*args, **kwargs)
File "C:\PROGRA~1\Python26\lib\site-packages\bzrlib\cleanup.py", line 135,
in run_simple
self.cleanups, self.func, *args, **kwargs)
File "C:\PROGRA~1\Python26\lib\site-packages\bzrlib\cleanup.py", line 165,
in _do_with_cleanups
result = func(*args, **kwargs)
File "C:\PROGRA~1\Python26\lib\site-packages\bzrlib\builtins.py", line
690, in run
no_recurse, action=action, save=not dry_run)
File "C:\PROGRA~1\Python26\lib\site-packages\bzrlib\mutabletree.py", line
48, in tree_write_locked
self.lock_tree_write()
File "C:\PROGRA~1\Python26\lib\site-packages\bzrlib\workingtree_4.py",
line 622, in lock_tree_write
return self._lock_self_write()
File "C:\PROGRA~1\Python26\lib\site-packages\bzrlib\workingtree_4.py",
line 602, in _lock_self_write
state.lock_write()
File "C:\PROGRA~1\Python26\lib\site-packages\bzrlib\dirstate.py", line
3065, in lock_write
self._lock_token = lock.WriteLock(self._filename)
File "C:\PROGRA~1\Python26\lib\site-packages\bzrlib\lock.py", line 413, in
__init__
os.O_RDWR, "rb+")
File "C:\PROGRA~1\Python26\lib\site-packages\bzrlib\lock.py", line 371, in
_open
raise errors.LockContention(filename, e)
bzrlib.errors.LockContention: Could not acquire lock
"C:/windows/temp/tmp-bbtuqtiq1/.bzr/checkout/dirstate":
(32, 'CreateFileW', 'The process cannot access the file because it is being
used by another process.')
I see two possibilities:
1) I'm calling cmd_add wrong. Certainly a possiblity, since the
calling conventions have changed a few times over the past two years.
2) This is a Bazaar bug (posibly fixed in more recent versions?). I
couldn't find much searching through Bazaar's list archives or bug
tracker. This is what I was able to find:
* A message pointing out issues with fast lock creation/removal [4].
The associated bug has been closed due to inability to reproduce
[4], but it seems that the Windows-specificity was never layed out
as clearly in the bug comments as it was in the original email.
* A huge thread discussing a bzr lock overhaul [5], but that thread
is too long for me to have read the whole thing. A cursory
inspection indicated that any bugs raised by the overhaul where
solved before the patch went in.
Any thoughts? Guidance?
Thanks,
Trevor
[1]: Two links into the broken thread:
http://void.printf.net/pipermail/be-devel/2011-February/000700.html
http://void.printf.net/pipermail/be-devel/2011-February/000702.html
[2]: http://void.printf.net/pipermail/be-devel/2011-February/000720.html
[3]: http://void.printf.net/pipermail/be-devel/2011-February/000723.html
[4]: http://article.gmane.org/gmane.comp.version-control.bazaar-ng.general/31718/
[5]: https://bugs.launchpad.net/bzr/+bug/140869
[6]: http://article.gmane.org/gmane.comp.version-control.bazaar-ng.general/59166
--
This email may be signed or encrypted with GPG (http://www.gnupg.org).
The GPG signature (if present) will be attached as 'signature.asc'.
For more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy
My public key is at http://www.physics.drexel.edu/~wking/pubkey.txt
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <https://lists.ubuntu.com/archives/bazaar/attachments/20110224/49acce69/attachment.pgp>
More information about the bazaar
mailing list