bad assertions it wt4._add()?

Blake Winton bwinton at latte.ca
Thu Aug 23 03:18:45 BST 2007


Martin Pool wrote:
> bwilson(?)

bwinton.  Close, though.  :)

 > on irc reported an assertion failure when committing a file
> whose name contains '..'.  I can't actually reproduce it, but these
> lines do look suspicious:

You could try running svn2bzr against the dump file at 
http://bwinton.latte.ca/bzr/small.dump  (It's 6 meg, and you'll probably 
need to patch svn2bzr to handle empty Node-path:s in the subversion dump 
files, a bundle for which is at 
http://bwinton.latte.ca/bzr/empty_node_path.patch)

>     @needs_tree_write_lock
>     def _add(self, files, ids, kinds):
>         """See MutableTree._add."""
>         state = self.current_dirstate()
>         for f, file_id, kind in zip(files, ids, kinds):
>             f = f.strip('/')
>             assert '//' not in f
>             assert '..' not in f
> 
> At those lines, f should be a single filename? And I don't see why we
> should be making those assertions about it.

My print statements indicated that it was a fully-qualified path name, 
at least as passed in from svn2bzr...

Or, run the code Rob suggested, which suggests that the _add method 
should perhaps also use osutils.relpath(self.basedir, path) to check 
that the files are children of the base path...

Later,
Blake.




More information about the bazaar mailing list