[BUG] bug in weave.join() code
Goffredo Baroncelli
kreijack at alice.it
Tue Jan 24 22:25:50 GMT 2006
On Tuesday 24 January 2006 21:21, John Arbash Meinel wrote:
> I found a pretty large bug in the Weave.join() code, which causes the
> code to freak out quite a bit. Specifically the code:
>
> if name in self._names:
> idx = self.lookup(name)
> n1 = map(other.idx_to_name, other._parents[other_idx] )
> n2 = map(self.idx_to_name, self._parents[other_idx] )
> if sha1 == self._sha1s[idx] and n1 == n2:
> continue
>
> Notice that it uses other_idx instead of 'idx' so this should be:
> n2 = map(self.idx_to_name, self._parents[idx] )
I wrote the code, so I can confirm that this is a bug!
However it very difficult that this bug can compromise the wevae,
in fact in order to raise the bug it have to happend:
weave1._parents[weave2_idx] == weave2._parents[weave2_idx]
and
sort(weave1._parents[weave1_idx]) != sort(weave2._parents[weave2_idx])
this can happen, but it is not very frequent
:-)
The patch below should solve,please Martin apply
=== modified file 'bzrlib/weave.py'
--- bzrlib/weave.py
+++ bzrlib/weave.py
@@ -833,7 +833,9 @@
if name in self._names:
idx = self.lookup(name)
n1 = map(other.idx_to_name, other._parents[other_idx] )
- n2 = map(self.idx_to_name, self._parents[other_idx] )
+ n2 = map(self.idx_to_name, self._parents[idx] )
+ n1.sort( )
+ n2.sort( )
if sha1 == self._sha1s[idx] and n1 == n2:
continue
--
gpg key@ keyserver.linux.it: Goffredo Baroncelli (ghigo) <kreijack_ at _inwind.it>
Key fingerprint = CE3C 7E01 6782 30A3 5B87 87C0 BB86 505C 6B2A CFF9
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20060124/e633744d/attachment.pgp
More information about the bazaar
mailing list