bzr workingtree interprets inventory xml as ascii incorrectly.
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Bazaar |
Fix Released
|
Medium
|
Unassigned | ||
bzr (Ubuntu) |
Fix Released
|
Medium
|
Unassigned |
Bug Description
The following patch fixes a severe bug in 0.8 : it will fail when given well formed xml encoded as utf8 in the inventory. It fails because it implicitly upcasts the serialized inventory from an ascii string when writing it to the working tree as utf8 - in actual fact it is already encoded as a utf8 bytestream and no conversion should be performed. Our current xml writer happens to emit ascii-safe inventory xml, but third party xml generators could well emit utf8, and its likely we will want to do so ourselves in future. Accordingly I'd like to put this fix into 0.8, and an update into dapper.
--- bzrlib/
+++ bzrlib/
@@ -1218,16 +1218,17 @@
-
+ assert isinstance(xml, str), 'serialised xml must be bytestring.'
path = self._basis_
- self._control_
+ sio = StringIO(xml)
+ self._control_
except WeaveRevisionNo
pass
def read_basis_
"""Read the cached basis inventory."""
path = self._basis_
- return self._control_
+ return self._control_
@needs_
def read_working_
Changed in bzr: | |
status: | Unconfirmed → Confirmed |
Changed in bzr: | |
importance: | Untriaged → Medium |
status: | Unconfirmed → Confirmed |
status: | Confirmed → Fix Released |
+1 on the patch in general, and feel free to merge to 0.8-fixes.
I'm not sure this justifies a new 0.8 release though. Instead we can just say that this format is defined to be in ascii (with entity escapes) rather than utf-8; this has the advantage of not requiring people to upgrade.