[BUG] duplicated path in cache r547

John A Meinel john at arbash-meinel.com
Wed May 25 14:56:51 BST 2005


William Dodé wrote:

>Hi,
>
>There is a bug if we add and remove a file AND use bzr
>status before commit :
>
>$ bzr init
>$ touch a
>$ bzr add a
>$ bzr remove a
>$ bzr add a
>$ bzr status
>added:
>  a
>$ bzr commit -m "a"
>bzr: error: duplicated path in cache: u'a'
>  at /vrac/python/bazaar-ng/bzrlib/statcache.py:169 in load_cache()
>  see ~/.bzr.log for debug information
>
>It doesn't scratch if we don't do bzr status
>  
>
This can also be triggered with:
$ bzr init; touch a; bzr add a; bzr remove a; bzr add a; bzr status
added:
  a
$ bzr status
bzr: error: duplicated path in cache: u'a'
  at /home/jameinel/dev/bzr/bzr.dev/bzrlib/statcache.py:169 in load_cache()
  see ~/.bzr.log for debug information

I think the specific bug here is that the id for a changes with an 
'add/remove/add' cycle. The stat-cache only updates based on file id, 
but when reading it checks for path name collisions.

The 'bug' here is that when you load the stat cache it is possible to 
get the same file with a different id (think del + rename).

I think the problem is in:
def _update_cache_from_list(basedir, cache, to_update):

at line 234: cacheentry = cache.get(file_id)

Here it only looks up the file by the file_id, though when reading the 
file it also looks at the path.

It seems like what you need is a second lookup by pathname, so that you 
can not only update the file_id, but also the path name.

John
=:->


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 253 bytes
Desc: OpenPGP digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20050525/846202b7/attachment.pgp 


More information about the bazaar mailing list