ERROR file id "None" is not present in the tree when checking the root entry

Bug #620684 reported by Pedro Bezunartea López
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Bazaar
Confirmed
Medium
Unassigned

Bug Description

Ubuntu lucid, bzr --version:
Bazaar (bzr) 2.1.1
  Python interpreter: /usr/bin/python 2.6.5
  Python standard library: /usr/lib/python2.6
  Platform: Linux-2.6.32-24-generic-x86_64-with-Ubuntu-10.04-lucid
  bzrlib: /usr/lib/python2.6/dist-packages/bzrlib

I initialised a directory I use for development. Just me. After a few modifications, additions and commits, 'bzr check' begins throwing the following error:
Checking working tree at '/media/data/.../dc'.
Checking branch at 'file:///media/data/.../dc/'.
Checking repository at 'file:///media/data/.../dc/'.
bzr: ERROR: The file id "None" is not present in the tree <bzrlib.inventory.CHKInventory object at 0x2d14c90>.

I include the full log. I also tried 'reconcile' unsuccessful.

3.792 Traceback (most recent call last):
  File "/usr/lib/python2.6/dist-packages/bzrlib/commands.py", line 853, in exception_to_return_code
    return the_callable(*args, **kwargs)
  File "/usr/lib/python2.6/dist-packages/bzrlib/commands.py", line 1055, in run_bzr
    ret = run(*run_argv)
  File "/usr/lib/python2.6/dist-packages/bzrlib/commands.py", line 661, in run_argv_aliases
    return self.run_direct(**all_cmd_args)
  File "/usr/lib/python2.6/dist-packages/bzrlib/commands.py", line 665, in run_direct
    return self._operation.run_simple(*args, **kwargs)
  File "/usr/lib/python2.6/dist-packages/bzrlib/cleanup.py", line 122, in run_simple
    self.cleanups, self.func, *args, **kwargs)
  File "/usr/lib/python2.6/dist-packages/bzrlib/cleanup.py", line 156, in _do_with_cleanups
    result = func(*args, **kwargs)
  File "/usr/lib/python2.6/dist-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.6/dist-packages/bzrlib/check.py", line 456, in check_dwim
    check_repo=do_repo)
  File "/usr/lib/python2.6/dist-packages/bzrlib/decorators.py", line 140, in read_locked
    result = unbound(self, *args, **kwargs)
  File "/usr/lib/python2.6/dist-packages/bzrlib/repository.py", line 2777, in check
    check_repo=check_repo)
  File "/usr/lib/python2.6/dist-packages/bzrlib/repository.py", line 2781, in _check
    result.check(callback_refs)
  File "/usr/lib/python2.6/dist-packages/bzrlib/check.py", line 106, in check
    self.check_weaves()
  File "/usr/lib/python2.6/dist-packages/bzrlib/check.py", line 296, in check_weaves
    self._check_weaves(storebar)
  File "/usr/lib/python2.6/dist-packages/bzrlib/check.py", line 305, in _check_weaves
    ancestors=self.ancestors)
  File "/usr/lib/python2.6/dist-packages/bzrlib/repository.py", line 2707, in _get_versioned_file_checker
    text_key_references=text_key_references, ancestors=ancestors)
  File "/usr/lib/python2.6/dist-packages/bzrlib/repository.py", line 4171, in __init__
    text_key_references=text_key_references, ancestors=ancestors)
  File "/usr/lib/python2.6/dist-packages/bzrlib/repository.py", line 2219, in _generate_text_key_index
    text_key_references = self.find_text_key_references()
  File "/usr/lib/python2.6/dist-packages/bzrlib/repofmt/groupcompress_repo.py", line 992, in find_text_key_references
    for _, entry in inv.iter_entries():
  File "/usr/lib/python2.6/dist-packages/bzrlib/inventory.py", line 780, in iter_entries
    if self.root is None:
  File "/usr/lib/python2.6/dist-packages/bzrlib/inventory.py", line 2242, in root
    return self[self.root_id]
  File "/usr/lib/python2.6/dist-packages/bzrlib/inventory.py", line 2019, in __getitem__
    raise errors.NoSuchId(self, file_id)
NoSuchId: The file id "None" is not present in the tree <bzrlib.inventory.CHKInventory object at 0x2d14c90>.

Revision history for this message
Pedro Bezunartea López (pedro-bezunartea) wrote :
Revision history for this message
Martin Pool (mbp) wrote :

Somehow you seem to have created some revisions with a root of None. Do you recall what operations you used to create this?

summary: - checking when ERROR file id "None" is not present in the tree
+ ERROR file id "None" is not present in the tree when checking the root
+ entry
description: updated
Revision history for this message
Pedro Bezunartea López (pedro-bezunartea) wrote :

I enclose the command history used with the directory versioned. It is based on the 'history' log, so it's not 100% reliable. It can give you an idea of how I created and managed the repository. I basically used bzr add, delete and commit command, nothing fancy.

I should also add that, at the beginning I transferred the directory to a windows machine, .bzr included, and run bzr under cygwin. This generated changes in file permissions (+/-x) that I did not want to be included, so I stopped using bzr under windows.

Martin Pool (mbp)
Changed in bzr:
status: New → Confirmed
importance: Undecided → Medium
Revision history for this message
Szilveszter Farkas (phanatic) wrote :

I was hit by this very same problem. See the relevant bzr.log entries attached.

As you can see, I was able to successfully run an export --per-file-timestamps, then committed a revision. After that I Ctrl-C'd a regular export, and after that I was still be able to export without --per-file-timestamps, but not with it anymore.

reconcile didn't help. Do you have any ideas how I could restore the repository/branch into a working state?

Revision history for this message
Martin Pool (mbp) wrote :

@phanatic, Uncommitting from that tree may get you going again.

Could you run with BZR_PDB=1 and then tell me what relpath it thinks it's exporting there?

It would be very strange if interrupting the export had any effect, since that should of course be a readonly operation.

Revision history for this message
Szilveszter Farkas (phanatic) wrote :

Thanks for the pointer Martin, it was indeed a bad relpath that caused the problem.

By editing dir_exporter() by hand, I could fix the problem:

-mtime = tree.get_file_mtime(tree.path2id(relpath), relpath)
+mtime = tree.get_file_mtime(tree.path2id(osutils.pathjoin(subdir, relpath)), relpath)

relpath is relative to the path I wanted to export, buth path2id expects a path relative to the branch root, so it just blew up when I wanted to export a subdir.

I'll try to find some time to properly test this against current lp:bzr, and also come up with a merge request.

Revision history for this message
Szilveszter Farkas (phanatic) wrote :

I have filed bug 795557 separately, because I believe it is unrelated to this one.

Jelmer Vernooij (jelmer)
tags: added: check-for-breezy
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.