Rev 5603: (vila) Avoid PermissionDenied errors on Windows when breaking corrupted in file:///home/pqm/archives/thelove/bzr/%2Btrunk/
Canonical.com Patch Queue Manager
pqm at pqm.ubuntu.com
Wed Jan 12 22:21:02 UTC 2011
At file:///home/pqm/archives/thelove/bzr/%2Btrunk/
------------------------------------------------------------
revno: 5603 [merge]
revision-id: pqm at pqm.ubuntu.com-20110112222059-opcgh8rveshvbb70
parent: pqm at pqm.ubuntu.com-20110112194804-4wkdy5dj69vcmqv8
parent: john at arbash-meinel.com-20110112204137-x9bhoxzyb5l6dh82
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Wed 2011-01-12 22:20:59 +0000
message:
(vila) Avoid PermissionDenied errors on Windows when breaking corrupted
locks. (John A Meinel)
modified:
bzrlib/lockdir.py lockdir.py-20060220222025-98258adf27fbdda3
bzrlib/tests/test_lockdir.py test_lockdir.py-20060220222025-33d4221569a3d600
doc/en/release-notes/bzr-2.3.txt NEWS-20050323055033-4e00b5db738777ff
=== modified file 'bzrlib/lockdir.py'
--- a/bzrlib/lockdir.py 2010-12-02 10:41:05 +0000
+++ b/bzrlib/lockdir.py 2011-01-12 20:31:15 +0000
@@ -1,4 +1,4 @@
-# Copyright (C) 2006-2010 Canonical Ltd
+# Copyright (C) 2006-2011 Canonical Ltd
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -430,8 +430,8 @@
# there's a small race window between checking it and doing the
# rename.
broken_info_path = tmpname + self.__INFO_NAME
- f = self.transport.get(broken_info_path)
- broken_lines = f.readlines()
+ broken_content = self.transport.get_bytes(broken_info_path)
+ broken_lines = osutils.split_lines(broken_content)
if broken_lines != corrupt_info_lines:
raise LockBreakMismatch(self, broken_lines, corrupt_info_lines)
self.transport.delete(broken_info_path)
=== modified file 'bzrlib/tests/test_lockdir.py'
--- a/bzrlib/tests/test_lockdir.py 2011-01-12 01:01:53 +0000
+++ b/bzrlib/tests/test_lockdir.py 2011-01-12 20:31:15 +0000
@@ -581,16 +581,12 @@
self.prompts.append(('boolean', prompt))
return True
ui = LoggingUIFactory()
- orig_factory = bzrlib.ui.ui_factory
- bzrlib.ui.ui_factory = ui
- try:
- ld2.break_lock()
- self.assertLength(1, ui.prompts)
- self.assertEqual('boolean', ui.prompts[0][0])
- self.assertStartsWith(ui.prompts[0][1], 'Break (corrupt LockDir')
- self.assertRaises(LockBroken, ld.unlock)
- finally:
- bzrlib.ui.ui_factory = orig_factory
+ self.overrideAttr(bzrlib.ui, 'ui_factory', ui)
+ ld2.break_lock()
+ self.assertLength(1, ui.prompts)
+ self.assertEqual('boolean', ui.prompts[0][0])
+ self.assertStartsWith(ui.prompts[0][1], 'Break (corrupt LockDir')
+ self.assertRaises(LockBroken, ld.unlock)
def test_break_lock_missing_info(self):
"""break_lock works even if the info file is missing (and tells the UI
=== modified file 'doc/en/release-notes/bzr-2.3.txt'
--- a/doc/en/release-notes/bzr-2.3.txt 2011-01-12 18:26:01 +0000
+++ b/doc/en/release-notes/bzr-2.3.txt 2011-01-12 22:20:59 +0000
@@ -65,6 +65,10 @@
* Avoid leaking SSH subprocess communication socket into unrelated child
processes, which could cause bzr to hang on exit. (Max Bowsher, #696285)
+* ``bzr break-lock`` on a corrupted lock file works correctly, rather than
+ raising a PermissionDenied error. We were accidentally holding open the
+ file we were trying to delete. (John Arbash Meinel, #659978)
+
* ``bzr update`` in a checkout of a readonly branch works again, without
trying to set the tags in the master branch. This had been broken by the
bug fix for bug #603395. (John Arbash Meinel, #701212)
More information about the bazaar-commits
mailing list