dirstate-tags commit fails with "integrity error" after moving directories around

Bug #94037 reported by Sabin Iacob
2
Affects Status Importance Assigned to Milestone
Bazaar
Fix Released
Critical
John A Meinel

Bug Description

iacobs@moria ~/tmp $ mkdir tst
iacobs@moria ~/tmp $ cd tst
iacobs@moria ~/tmp/tst $ bzr init --dirstate-tags
iacobs@moria ~/tmp/tst $ mkdir -p some/test/dir
iacobs@moria ~/tmp/tst $ touch some/test/dir/file.txt
iacobs@moria ~/tmp/tst $ touch some/test/foo.txt
iacobs@moria ~/tmp/tst $ bzr add .
added some
added some/test
added some/test/dir
added some/test/foo.txt
added some/test/dir/file.txt
iacobs@moria ~/tmp/tst $ bzr ci -m "bug take 1"
added some
added some/test
added some/test/dir
added some/test/dir/file.txt
added some/test/foo.txt
Committed revision 1.
iacobs@moria ~/tmp/tst $ bzr mv some/test/* some/
some/test/dir => some/dir
some/test/foo.txt => some/foo.txt
iacobs@moria ~/tmp/tst $ bzr ci -m "bug take 2"
renamed some/test/dir => some/dir
bzr: ERROR: integrity error ? : mismatching tree_index, file_id and path

Related branches

Revision history for this message
Sabin Iacob (iacobs) wrote : Re: [Bug 94037] dirstate-tags commit fails with "integrity error" after moving directories around

commenting out the code that issues the error seems to work, but I'm not
sure about the implications (there probably are cases when what it does
is useful, right?);
I did some primitive debugging by adding prints here and there and
raising an unhendled exception to get a backtrace; here's what I got:

renamed some/test/dir => some/dir
('file.txt-20070320092826-snuzo3d2flqq9737-5', None)
Traceback (most recent call last):
  File "/usr/bin/bzr", line 95, in ?
    exit_val = bzrlib.commands.main(sys.argv)
  File "/usr/lib/python2.4/site-packages/bzrlib/commands.py", line 643,
in main
    ret = run_bzr_catch_errors(argv)
  File "/usr/lib/python2.4/site-packages/bzrlib/commands.py", line 650,
in run_bzr_catch_errors
    return run_bzr(argv)
  File "/usr/lib/python2.4/site-packages/bzrlib/commands.py", line 612,
in run_bzr
    ret = run(*run_argv)
  File "/usr/lib/python2.4/site-packages/bzrlib/commands.py", line 304,
in run_argv_aliases
    return self.run(**all_cmd_args)
  File "/usr/lib/python2.4/site-packages/bzrlib/builtins.py", line 2119,
in run
    reporter=reporter)
  File "/usr/lib/python2.4/site-packages/bzrlib/decorators.py", line
165, in write_locked
    return unbound(self, *args, **kwargs)
  File "/usr/lib/python2.4/site-packages/bzrlib/workingtree_4.py", line
244, in commit
    result = WorkingTree3.commit(self, message, revprops, *args, **kwargs)
  File "/usr/lib/python2.4/site-packages/bzrlib/decorators.py", line
165, in write_locked
    return unbound(self, *args, **kwargs)
  File "/usr/lib/python2.4/site-packages/bzrlib/mutabletree.py", line
160, in commit
    revprops=revprops, *args, **kwargs)
  File "/usr/lib/python2.4/site-packages/bzrlib/commit.py", line 319, in
commit
    self._populate_new_inv()
  File "/usr/lib/python2.4/site-packages/bzrlib/commit.py", line 611, in
_populate_new_inv
    kind = self.work_tree.kind(file_id)
  File "/usr/lib/python2.4/site-packages/bzrlib/decorators.py", line
127, in read_locked
    return unbound(self, *args, **kwargs)
  File "/usr/lib/python2.4/site-packages/bzrlib/workingtree_4.py", line
532, in kind
    relpath = self.id2path(file_id)
  File "/usr/lib/python2.4/site-packages/bzrlib/decorators.py", line
127, in read_locked
    return unbound(self, *args, **kwargs)
  File "/usr/lib/python2.4/site-packages/bzrlib/workingtree_4.py", line
469, in id2path
    entry = self._get_entry(file_id=file_id)
  File "/usr/lib/python2.4/site-packages/bzrlib/workingtree_4.py", line
405, in _get_entry
    return state._get_entry(0, fileid_utf8=file_id, path_utf8=path)
  File "/usr/lib/python2.4/site-packages/bzrlib/dirstate.py", line 1401,
in _get_entry
    path_utf8=real_path)
  File "/usr/lib/python2.4/site-packages/bzrlib/dirstate.py", line 1364,
in _get_entry
    raise "aaaaaaaaaaaa %s %s" % (fileid_utf8, path_utf8)
aaaaaaaaaaaa file.txt-20070320092826-snuzo3d2flqq9737-5 some/dir

the funny thing is, the first print is in workingtree_4.py, _get_entry,
line 404, right before calling state._get_entry, and path is None, but
then the dirstate get_entry receives "some/dir";

/me very confused

Revision history for this message
John A Meinel (jameinel) wrote :

It turns out this is a bug in the WorkingTree4.move() logic.
Basically, when moving a directory, child entries were improperly renamed such that the reference pointed to the directory instead of the child. (example, if you moved dir/subdir => subdir, then dir/subdir/file would have a rename pointer to subdir, rather than subdir/file).

There is a fix in the associated branch. And this should be merged for 0.15

Changed in bzr:
assignee: nobody → jameinel
importance: Undecided → Critical
status: Unconfirmed → Fix Committed
Revision history for this message
Alexander Belchenko (bialix) wrote :

What the current status of this bug? Is your patch mergedto 0.15?

Revision history for this message
John A Meinel (jameinel) wrote :

in 0.15-final and bzr.dev

Changed in bzr:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.