bzr check backtraces on corrupted dirstate file

Bug #681278 reported by Juan Miguel Taboada Godoy
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Bazaar
Confirmed
High
Unassigned

Bug Description

After upgrading from 1.5 to 2.1.2 having the error reported as BUG number '681257' I got this error:

$ bzr check
Checking working tree at '/var/www/tarificador.interhanse.com/desarrollo'.
Checking branch at 'file:///var/www/tarificador.interhanse.com/desarrollo/'.
Checking repository at 'file:///var/www/tarificador.interhanse.com/desarrollo/'.
bzr: ERROR: exceptions.AssertionError: get_next() called when there are no chars left

Traceback (most recent call last):
  File "/usr/lib/python2.5/site-packages/bzrlib/commands.py", line 853, in exception_to_return_code
    return the_callable(*args, **kwargs)
  File "/usr/lib/python2.5/site-packages/bzrlib/commands.py", line 1055, in run_bzr
    ret = run(*run_argv)
  File "/usr/lib/python2.5/site-packages/bzrlib/commands.py", line 661, in run_argv_aliases
    return self.run_direct(**all_cmd_args)
  File "/usr/lib/python2.5/site-packages/bzrlib/commands.py", line 665, in run_direct
    return self._operation.run_simple(*args, **kwargs)
  File "/usr/lib/python2.5/site-packages/bzrlib/cleanup.py", line 122, in run_simple
    self.cleanups, self.func, *args, **kwargs)
  File "/usr/lib/python2.5/site-packages/bzrlib/cleanup.py", line 156, in _do_with_cleanups
    result = func(*args, **kwargs)
  File "/usr/lib/python2.5/site-packages/bzrlib/builtins.py", line 3225, in run
    check_dwim(path, verbose, do_branch=branch, do_repo=repo, do_tree=tree)
  File "/usr/lib/python2.5/site-packages/bzrlib/check.py", line 456, in check_dwim
    check_repo=do_repo)
  File "/usr/lib/python2.5/site-packages/bzrlib/decorators.py", line 140, in read_locked
    result = unbound(self, *args, **kwargs)
  File "/usr/lib/python2.5/site-packages/bzrlib/repository.py", line 2777, in check
    check_repo=check_repo)
  File "/usr/lib/python2.5/site-packages/bzrlib/repository.py", line 2781, in _check
    result.check(callback_refs)
  File "/usr/lib/python2.5/site-packages/bzrlib/check.py", line 146, in check
    item._check(refs)
  File "/usr/lib/python2.5/site-packages/bzrlib/decorators.py", line 140, in read_locked
    result = unbound(self, *args, **kwargs)
  File "/usr/lib/python2.5/site-packages/bzrlib/workingtree.py", line 2599, in _check
    if len(list(repo_basis.iter_changes(tree_basis))) > 0:
  File "/usr/lib/python2.5/site-packages/bzrlib/tree.py", line 1066, in iter_changes
    specific_file_ids=specific_file_ids))
  File "/usr/lib/python2.5/site-packages/bzrlib/decorators.py", line 140, in read_locked
    result = unbound(self, *args, **kwargs)
  File "/usr/lib/python2.5/site-packages/bzrlib/tree.py", line 201, in iter_entries_by_dir
    return self.inventory.iter_entries_by_dir(
  File "/usr/lib/python2.5/site-packages/bzrlib/workingtree_4.py", line 1818, in _get_inventory
    self._generate_inventory()
  File "/usr/lib/python2.5/site-packages/bzrlib/workingtree_4.py", line 1680, in _generate_inventory
    self._dirstate._read_dirblocks_if_needed()
  File "/usr/lib/python2.5/site-packages/bzrlib/dirstate.py", line 2202, in _read_dirblocks_if_needed
    _read_dirblocks(self)
  File "_dirstate_helpers_pyx.pyx", line 767, in bzrlib._dirstate_helpers_pyx._read_dirblocks
  File "_dirstate_helpers_pyx.pyx", line 733, in bzrlib._dirstate_helpers_pyx.Reader._parse_dirblocks
  File "_dirstate_helpers_pyx.pyx", line 679, in bzrlib._dirstate_helpers_pyx.Reader._get_entry
  File "_dirstate_helpers_pyx.pyx", line 572, in bzrlib._dirstate_helpers_pyx.Reader.get_next_str
  File "_dirstate_helpers_pyx.pyx", line 554, in bzrlib._dirstate_helpers_pyx.Reader.get_next
AssertionError: get_next() called when there are no chars left

bzr 2.1.2 on python 2.5.5 (Linux-2.6.18-6-xen-vserver-686-i686-with-debian-5.0.6)
arguments: ['/usr/bin/bzr', 'check']
encoding: 'UTF-8', fsenc: 'UTF-8', lang: 'en_US.UTF-8'
plugins:
  bzrtools /usr/lib/python2.5/site-packages/bzrlib/plugins/bzrtools [2.1.0]
  launchpad /usr/lib/python2.5/site-packages/bzrlib/plugins/launchpad [2.1.2]
  netrc_credential_store /usr/lib/python2.5/site-packages/bzrlib/plugins/netrc_credential_store [2.1.2]
  news_merge /usr/lib/python2.5/site-packages/bzrlib/plugins/news_merge [2.1.2]

*** Bazaar has encountered an internal error. This probably indicates a
    bug in Bazaar. You can help us fix it by filing a bug report at
        https://bugs.launchpad.net/bzr/+filebug
    including this traceback and a description of the problem.

Thanks again.

Revision history for this message
Juan Miguel Taboada Godoy (juanmi-centrologic) wrote :

Is related to BUG #681257

Revision history for this message
Juan Miguel Taboada Godoy (juanmi-centrologic) wrote :

Hello, I found a temporal solution to repair the repository:

You can repair your bazaar repository (loosing the uncommited changes) using the next steps:
mv .bzr/checkout .bzr/oldcheckout
run bzr checkout --lightweight . ../tempcheckout
cp ../tempcheckout/.bzr/checkout .bzr/

Sincerely.

Revision history for this message
Vincent Ladeuil (vila) wrote :

https://answers.edge.launchpad.net/bzr/+faq/940 is a less invasive workaround (there are other files you want to preserve in .bzr/checkout).

summary: - bzr: ERROR: exceptions.AssertionError: get_next() called when there are
- no chars left
+ bzr check backtraces on corrupted dirstate file
Revision history for this message
Vincent Ladeuil (vila) wrote :

bzr shouldn't backtrace in this case, at worst it should stop further verifications and issue a proper error message.

Additional bonus if bzr reconcile implements https://answers.edge.launchpad.net/bzr/+faq/940

Changed in bzr:
importance: Undecided → High
status: New → Confirmed
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.